Mar 27, 2012, 10:30 AM
v2.0 Gridview Cell Conditional formatting
Hi, one of the differences in the example Desktop given for v1.x and v2.0 (beta) is that the colour formatting
in the Gridview has been removed from the v2.0 example. In v1.x the "Change" and "Change %" cells were coloured either Red or Green depending on their values.
When I installed Ext.Net v2.0 and downloaded the new desktop example it worked fine. I then tried to incorperate the colour formatting from the v1.x example but this fails with the following error "Microsoft JScript runtime error: 'template' is undefined".
I can't figure out why it isn't working. Can you help?
Code samples
Client-side javascript for formatting (copied from v1.x example):
Grid column definition:
in the Gridview has been removed from the v2.0 example. In v1.x the "Change" and "Change %" cells were coloured either Red or Green depending on their values.
When I installed Ext.Net v2.0 and downloaded the new desktop example it worked fine. I then tried to incorperate the colour formatting from the v1.x example but this fails with the following error "Microsoft JScript runtime error: 'template' is undefined".
I can't figure out why it isn't working. Can you help?
Code samples
Client-side javascript for formatting (copied from v1.x example):
<script type="text/javascript">
var change = function (value) {
return String.format(template, (value > 0) ? "green" : "red", value);
};
var pctChange = function (value) {
return String.format(template, (value > 0) ? "green" : "red", value + "%");
};
</script>
Grid column definition:
<ext:Column runat="server" Text="Change" Width="70" Sortable="true" DataIndex="Change" >
<Renderer Fn="change" />
</ext:Column>
<ext:Column runat="server" Text="% Change" Width="70" Sortable="true" DataIndex="PctChange" >
<Renderer Fn="pctChange" />
</ext:Column>