Feb 06, 2012, 10:34 AM
Displaying an Image/Icon inside an EXT.NET GridPanel Cell with value (depinding on value)
Greetings forumnites,
I have a question regarding rendering an Icon in a cell depending on the value.
The value comes from the datatable. The value can either be a string ?good? or ?bad? and resides in the column ?Status?.
Layout:
For example: http://miamicoder.com/2009/displayin...l-cell-part-2/
I have a question regarding rendering an Icon in a cell depending on the value.
The value comes from the datatable. The value can either be a string ?good? or ?bad? and resides in the column ?Status?.
Layout:
<ext:GridPanel ID="grid" runat="server">
<Store>
<ext:Store ID="Store1" runat="server">
<Reader>
<ext:ArrayReader>
<Fields>
<ext:RecordField Name="status" Mapping="Status" />
<Renderer Handler = "imgRenderer()" />
</Fields>
</ext:ArrayReader>
</Reader>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column DataIndex="status" Header="Status" Width="160">
</ext:Column>
</Columns>
</ColumnModel>
</ext:GridPanel>
I tried something like this, with no avail:<script type="text/javascript">
function imgRenderer(value, meta, record, rowIndex, colIndex, store) {
if(data == ?good?)
{
return "<img src='accept.png'/>"
}
else (data == "bad")
{
return "<img src='cancel.png'/>"
}
}
</script>
I am new to this, I googled for some examples but it doesn't really fit into mine implementation. For example: http://miamicoder.com/2009/displayin...l-cell-part-2/
Last edited by Daniil; Feb 06, 2012 at 12:23 PM.
Reason: Please use [CODE] tags