// create ActiveWidgets Grid javascript object
var obj = new Active.Controls.Grid;
// set number of rows/columns
obj.setRowProperty("count", 20);
obj.setColumnProperty("count", 5);
// provide cells and headers text
obj.setDataProperty("text", function(i, j){return myData[i][j]});
obj.setColumnProperty("text", function(i){return myColumns[i]});
// set headers width/height
obj.setRowHeaderWidth("28px");
obj.setColumnHeaderHeight("20px");
obj.setEvent("ondblclick", function(){this.action("myAction")});
obj.setAction("myAction", function(src){alert(src.getRowProperty('index') + ":" + src.getColumnProperty('index'))});
// write grid html to the page
document.write(obj);
// create ActiveWidgets Grid javascript object
var obj = new Active.Controls.Grid;
// set number of rows/columns
obj.setRowProperty("count", 20);
obj.setColumnProperty("count", 5);
// provide cells and headers text
obj.setDataProperty("text", function(i, j){return myData[i][j]});
obj.setColumnProperty("text", function(i){return myColumns[i]});
// set headers width/height
obj.setRowHeaderWidth("28px");
obj.setColumnHeaderHeight("20px");
// trigger myAction on cell double click
obj.getColumnTemplate().setEvent("ondblclick", function(){this.action("myAction")});
// show cell row/col indexes
obj.setAction("myAction", function(src){
alert(src.getRowProperty('index') + ":" + src.getColumnProperty('index'));
});
// write grid html to the page
document.write(obj);
var selectedRow = 0;
var selectedCol = 0;
obj.setAction('click', function(src){
selectedRow = src.getColumnProperty('index');
selectedCol = src.getRowProperty('index');
});
obj.setEvent('ondblclick', function(event, src) {
alert("Clicked on Row " + selectedRow + " and Column " + selectedCol);
});
This topic is archived.