Customize Row and Column Titles

From Documentation
Revision as of 04:16, 18 November 2010 by Samchuang (talk | contribs) (Created page with '{{ZKSpreadsheetEssentialsPageHeader}} __TOC__ ZK Spreadsheet can set customize title by Spreadsheet.setColumntitles() and Spreadsheet.setRowtitles() ==Scenario== User can doub…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


ZK Spreadsheet can set customize title by Spreadsheet.setColumntitles() and Spreadsheet.setRowtitles()

Scenario

User can double click on header to edit the title, user can click Enter to confirm change or click Ecs to cancel title editing.

Current Title

We can use onHeaderClick, onHeaderRightClick or onHeaderDoubleClick to get current header that user clicked, in here, we use onHeaderDoubleClick as a example.

Prepare

opup inputTitlePopup;
Textbox titleEditor;

Spreadsheet spreadsheet;

1. we can get clicked header type by

HeaderMouseEvent.getType();

2. we can get header title by

public void onHeaderDoubleClick$spreadsheet(HeaderMouseEvent event) {
	String currentTitle = null;
	int headerType = event.getType();
	if (headerType == HeaderEvent.TOP_HEADER) {
		currentTitle = spreadsheet.getColumntitle(currentIndex);
	} else {
		currentTitle =  spreadsheet.getRowtitle(currentIndex);
	}
...

3. Then, set the current header title to textbox and open the popup.

 Popup inputTitlePopup;
Textbox titleEditor;

public void onHeaderDoubleClick$spreadsheet(HeaderMouseEvent event) {
...
	inputTitlePopup.open(event.getPageX(), event.getPageY());
	titleEditor.setText(currentTitle);
	titleEditor.focus();
}


Version History

Last Update : 2010/11/18


Version Date Content
     


All source code listed in this book is at Github.


Last Update : 2010/11/18

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.