Problem with selectionChanged event
Hello
I'm having some problems with the selectionChanged event. I want to be able to click on a row, then have the data in that row display someplace else. Here's the relevant section of my code:
function fdata()
{
var array = obj.getProperty("selection/values");
document.getElementById("asdf").innerHTML = array[0];
}
</script>
</head>
<body>
<div id="asdf" onClick="fdata()">test</div>
<script>
// create ActiveWidgets Grid javascript object
var obj = new Active.Controls.Grid;
// set number of rows/columns
obj.setRowCount(num_rows);
obj.setColumnCount(12);
// set grid to single selection
obj.setProperty("selection/multiple", false);
// provide cells and headers text
obj.setDataText(function(i, j){return myData[i][j]});
obj.setColumnText(function(i){return myColumns[i]});
var row = obj.getTemplate("row");
row.setEvent("onmouseover", "mouseover(this, 'active-row-highlight')");
row.setEvent("onmouseout", "mouseout(this, 'active-row-highlight')");
obj.setAction("selectionChanged",fdata());
// write grid html to the page
document.write(obj);
If I click on the 'asdf' div, the fdata() function works fine. However clicking on a row in the grid does not fire fdata(). Could you tell me how to make this happen? Also - could you explain the difference between the setEvent and setAction functions, and when to use each of them?
Thanks
I'm having some problems with the selectionChanged event. I want to be able to click on a row, then have the data in that row display someplace else. Here's the relevant section of my code:
function fdata()
{
var array = obj.getProperty("selection/values");
document.getElementById("asdf").innerHTML = array[0];
}
</script>
</head>
<body>
<div id="asdf" onClick="fdata()">test</div>
<script>
// create ActiveWidgets Grid javascript object
var obj = new Active.Controls.Grid;
// set number of rows/columns
obj.setRowCount(num_rows);
obj.setColumnCount(12);
// set grid to single selection
obj.setProperty("selection/multiple", false);
// provide cells and headers text
obj.setDataText(function(i, j){return myData[i][j]});
obj.setColumnText(function(i){return myColumns[i]});
var row = obj.getTemplate("row");
row.setEvent("onmouseover", "mouseover(this, 'active-row-highlight')");
row.setEvent("onmouseout", "mouseout(this, 'active-row-highlight')");
obj.setAction("selectionChanged",fdata());
// write grid html to the page
document.write(obj);
If I click on the 'asdf' div, the fdata() function works fine. However clicking on a row in the grid does not fire fdata(). Could you tell me how to make this happen? Also - could you explain the difference between the setEvent and setAction functions, and when to use each of them?
Thanks
AlU
January 5,