More information on this topic is available in the documentation section: /general.faq.releases/.
var myRows = ["11111", "22222", "33333", "44444", "55555"];
obj.setRowValues(myRows);
var myData = [
["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"],
["ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"],
["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420", "28961"],
["CA", "Computer Associates Inter", "15,606.335", "3,164.000", "16000"],
["ERTS", "Electronic Arts Inc.", "14,490.895", "2,503.727", "4000"]
];
var obj = new AW.UI.Grid;
obj.setColumnCount(5);
obj.setRowCount(5);
obj.setRowIndices( ["111", "222", "333", "444", "555"] );
obj.setCellText(myData);
document.write(obj);
As you say in the grid.htm example, the setRowIndices() method is used to re-arrange or hide rows, not set the RowIDs. /********************************************************************
re-arrange rows
********************************************************************/
obj.setRowIndices([0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]); // hide row 1
document.write(obj);([19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0]); // reverse order
This is a VERY desirable function to have, I agree, but if I could associate the RowIDs with the data IDs in my SQL database (which is what I am trying to do) then filtering the data in the grid 'on the fly' will be so easy - I simply assemble a list of data IDs using a SQL SELECT statement and pass it to the grid using setRowIndices() and voila! - I have filtered my list.var myData = [];
myData["111"] = ["MSFT","Microsoft Corporation", "314,571.156", "32,187.000"];
myData["222"] = ["ORCL", "Oracle Corporation", "62,615.266", "9,519.000"];
myData["333"] = ["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420"];
myData["444"] = ["CA", "Computer Associates Inter", "15,606.335", "3,164.000"];
myData["555"] = ["ERTS", "Electronic Arts Inc.", "14,490.895", "2,503.727"];
var myColumns = ["Ticker", "Company Name", "Market Cap.", "$ Sales"];
var obj = new AW.UI.Grid;
obj.setCellText(myData);
obj.setHeaderText(myColumns);
obj.setRowIndices(["111", "222", "333", "444", "555"]);
obj.setRowCount(5);
obj.setColumnCount(4);
obj.setSelectorVisible(true);
obj.setSelectorWidth(35);
obj.setSelectorText(function(i){return i});
//obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
document.write(obj);
obj.onCellClicked = function(event, col, row){
window.status = "row: " + row + " column: " + col;
};
In general, I think using cutom indices might be a very good idea if you split your application logic between client- and server-side. For example, server-side sorting or filtering would be just sending new row indices array and not the whole data set.