3.0 beta 2

style visited rows differently

I'd like to style the rows that have been accessed differently from others.

in my grid, i use the mouseover code to show the cursor position.
and the .active-grid-row selector to style the current selected row.

once a row has been selected i'd like to show it as italics. (like the difference between a read and unread message in outlook)

I'm sure it is easily done, I just can't figure it out from the examples or the forum

thanks.

btw: if I get this working It will result in a multi-server multi-developer license purchase.



diablo
August 14,
answering my own question....

function gridClick(src) {
var index = parseInt(grid.getProperty("selection/index"));
visited[index]=1;
grid.refresh();
...
}

visited = new Array(myData.length);
var visit = function(){
return visited[this.getProperty("row/order")] ? "normal italic" : "bold" ;
}

...

var row = new Active.Templates.Row;
row.setEvent("onmouseover", "mouseover(this, 'active-row-highlight')");
row.setEvent("onmouseout", mouseout(this,'active-row-highlight')");
row.setStyle("font", visit);
grid.setTemplate("row", row);
grid.setAction("selectionChanged", function(src){gridClick(src)});

every time a row is selected I set the value in the array and then the visit function will return the correct function.

redrawing a single row would helpful as the grid.refresh() is relatively expensive
diabl0
August 14,
grid.getTemplate("row", i).refresh();
diablo
August 14,
dammit... sorting breaks it.

getting closer though...
August 14,
the following works a charm. changed my tracking array to a hash.
and switched the visit function to item/index

schwwwwweeeeet!

function gridClick(src) {
var index = parseInt(grid.getProperty("selection/index"));

var id = myData[index][1];
visited[id]=1; // column 1 is my primary key

grid.refresh();
...
}

visited = new Array();
var visit = function(){
return visited[this.getProperty("item/index")] ? "normal italic" : "bold" ;
}

...

var row = new Active.Templates.Row;
row.setEvent("onmouseover", "mouseover(this, 'active-row-highlight')");
row.setEvent("onmouseout", mouseout(this,'active-row-highlight')");
row.setStyle("font", visit);
grid.setTemplate("row", row);
grid.setAction("selectionChanged", function(src){gridClick(src)});
August 14,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.