:: Forum >>

Feature Wishlist

I love this thing, I'd like to see a totals row, and conditional row highlighting.

If I figure out how to do it, I'll submit a patch.
Brian Morin
Tuesday, November 4, 2003
Brian,

the conditional row formatting should be already possible. Let’s imagine you want to emphasize all rows where the number of employees is > 1000.

First you need to define your formatting style:

<style>
.active-highlight-true {background: infobackground; color: highlight; font-style: italic}
</style>


Then you need to define a new property on your data model, implemented by a custom function. This function will return true for the rows we want to highlight:

obj.defineProperty("data/test", function(i){return myData[i][4]>10000});


Get access to the row template:

var row = obj.getTemplate("data/item");


Assign the call to your new "test" property to the row stylesheet class:

row.setClass("highlight", function(){return this.getProperty("item/test")});

Here is small trick – your data model becomes item model when you jump from table level into row level, that’s why its item/test and not data/test. Also note that style selectors have prefix-name-value form, where prefix=active, so it becomes "active-highlight-true" for our rows.

This is full script again:

<script>
obj.defineProperty("data/test", function(i){return myData[i][4]>10000});
var row = obj.getTemplate("data/item");
row.setClass("highlight", function(){return this.getProperty("item/test")});
</script>

Totals row is more complicated - so I put it into the wish list.

ActiveWidgets
Alex (ActiveWidgets)
Tuesday, November 4, 2003

This topic is archived.


Back to support forum

Forum search