EnterpriseSheet Customization

2 way custom data binding



EnterpriseSheet provides a 2-way data communication between sheet and customer data source. Customer data object can be binded to the cell through custom defined function.

To achieve this, a custom function need to be defined which will be triggered by the end-user.


/**
 * This is custom defined function to popup custom editor for data communicate.
 * @param {Object} jsonData: the json data in the cell
 * @param {Integer} row: the row index for the cell
 * @param {Integer} column: the column index for the cell
 * @return {String}: the html string to be displayed during mouse move over
 */
function CUSTOM_2WAY_BINDING_DATA_FN(jsonData, row, column) {
	var cellEditor = Ext.create('customer.CellEditor',{
		jsonData: jsonData,
		row: row,
		column: column
	});
	cellEditor.show();
}
    
The above defined custom function in the json data will be consumed by the sheet. Such as: onCustomBindingFn: "CUSTOM_2WAY_BINDING_DATA_FN"

callback2wayDataBindingJson : {
	fileName: 'Cell data binding',
	sheets: [ {name: 'First', id: 1, color: 'red' } ],
	floatings: [
	   { sheet:1, name:"merge1", ftype:"meg", json:"[2,2,2,6]" },
	],
	cells: [
		{ sheet: 1, row: 9, col: 2, json: {data: "Move mouse over the following name to see more detail information in popup window." } }, 
		{ sheet: 1, row: 11, col: 2, json: {data: "Larry Page, Google Inc.", onCustomBindingFn: "CUSTOM_2WAY_BINDING_DATA_FN", id:"1000", color: "blue" } }
	]
}

End-user moves over the cell and custom function "CUSTOM_2WAY_BINDING_DATA_FN" will be invoked with 3 parameters: JsonData object, row index, column index.

Custom cell editor is popup for end-user to process actions, and make data communicate between sheet and custom cell editor.

 

 


Copyright © FeyaSoft Inc. All rights reserved.