3.2.0

Update a single cell?

Awesome control!

Can a single cell be updated without repainting all rows and columns?

Steve
December 18,
To repaint the grid use: obj.refresh();
To repaint the single row: obj.getTemplate("row", i).refresh();

Example:

var counter = 0;
var myUpdate = function(){
myData[0][0] = counter++;
obj.getTemplate("row", 0).refresh();
}
window.setInterval(myUpdate, 200);

Repainting the single cell only works from within an event or action handler (due to some bugs, will be corrected). In action handler the first argument refers to the action source, so you can use src.refresh();

var myAction = function(src){
var i = src.getProperty("row/index");
var j = src.getProperty("column/index");
myData[i][j] = "[new data]";
src.refresh();
}
obj.setAction("click", myAction);

Alex
Alex (ActiveWidgets)
December 18,
Thanks Alex
December 18,
<html>
<head>
    <script src="runtime/lib/aw.js"></script>
    <link href="runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<style>

</style>
<script>

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"],
 ["CA", "Computer Associates Inter", "15,606.335", "3,164.000"],
 ["ERTS", "Electronic Arts Inc.", "14,490.895", "2,503.727"]
];

var obj = new AW.UI.Grid;

obj.setCellText(myCells);
obj.setColumnCount(4);
obj.setRowCount(5);

document.write(obj);

var myAction = function(obj){
var i = obj.getProperty("row/index");
var j = obj.getProperty("column/index");
myCells[i][j] = "[new data]";
obj.refresh();
}
obj.setAction("click", myAction);

</script>
</body>
</html>
Row Refresh, Can You please correct this code?, please help urgent
October 18,

This topic is archived.

See also:


Back to support forum