var myData = [
["<input type=checkbox>","MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"],
["<input type=checkbox>","ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"],
...
var myColumns = [
"", "Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"
// Array of what is and isn't checked
var isChecked = new Array();
for(var i=0;i<20;i++) {
isChecked[i] = 0;
}
var isChecked = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
// Store array of what's been checked
// Note: works only for getting on/off status & not for getting a "value"
var isItChecked = function(src) {
// If we don't set the selected item now,
// then it won't happen until *after* this function exits.
var theIndex = src.getProperty("item/index");
obj.setProperty("selection/index",theIndex);
// Make sure we clicked the checkbox and
// not something else on the grid
if(src.getProperty("item/text").indexOf("<input type=checkbox>") != -1) {
(!(isChecked[theIndex])) ? isChecked[theIndex] = 1 : isChecked[theIndex] = 0;
}
}
obj.setAction("click", isItChecked);
function seeChecked() {
for(var i=0;i<isChecked.length;i++) {
if(isChecked[i]) {
alert("Item " + i);
}
}
}
<P><input type=button value="See what's checked" onClick="javascript:seeChecked();">
This topic is archived.