Contains the properties (text, image, tooltip etc.) of the grid cell.
The cell model implements the default get
and set
methods for accessing the cell data in javascript arrays. The external cell model object can be attached to replace all or some of the built-in cell methods to allow different types of cell data sources (XML, CSV etc.).
var value = obj.getCellProperty(name); // Retrieve property by name
obj.setCellProperty(name, value); // Assign property value
obj.defineCellProperty(name, value); // Define new property
var external = obj.getCellModel(); // Get reference to external model
obj.setCellModel(external); // Assign external model
obj.clearCellModel(); // Clear/reset all properties
data | Cell data. |
editable | Indicates whether the cell can be edited. |
format | Cell formatting object. |
image | Cell image. |
link | Cell hyperlink URL. |
selected | Indicates whether the cell is selected. |
state | Cell state. |
text | Cell text. |
tooltip | Cell tooltip. |
value | Cell value. |
Loading cell data from the javascript array
var myCells = [
["MSFT","Microsoft Corporation", "314,571.156", "32,187.000"],
["ORCL", "Oracle Corporation", "62,615.266", "9,519.000"],
["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420"]
];
var obj = new AW.UI.Grid;
obj.setCellText(myCells); // link to the js array
obj.setColumnCount(4);
obj.setRowCount(3);
document.write(obj);
Using external XML datasource
var table = new AW.XML.Table;
table.setURL("/examples/data/companies-simple.xml");
table.request();
var obj = new AW.UI.Grid;
obj.setCellModel(table); // assign external cell datasource
obj.setColumnCount(5);
CSV text file
var table = new AW.CSV.Table;
table.setURL("/examples/data/companies.txt");
table.request();
var obj = new AW.UI.Grid;
obj.setCellModel(table); // assign external cell datasource
obj.setColumnCount(5);
Loading grid data: javascript arrays, XML, CSV