Aug 23, 2013, 11:16 AM
Grid. Checkbox render function - how to execute default render of control
I try to do a simple change of a checkbox cell in a grid. The change depends on another field in the record.
My approach is to use the render function on the grid column like this
<ext:CheckColumn ID="CheckColumn3" runat="server" Text="sample" Align="Center" Width="60" Editable="true" DataIndex="sample">
<Renderer Fn="renderCheckBox "/>
</ext:CheckColumn>
var renderCheckBox = function (value, metaData, record, rowIndex, colIndex, store, view) {
if (record.get("otherbooleanfield") == 1) {
return "";
}
return someDefaultRenderingLogicOnCheckBox
// return "<input type='checkbox'" + (value ? "checked='checked'" : "") + ">"; works but returns a simple checkbox without CSS and does not look like other checkboxes in the grid
};
My approach is to use the render function on the grid column like this
<ext:CheckColumn ID="CheckColumn3" runat="server" Text="sample" Align="Center" Width="60" Editable="true" DataIndex="sample">
<Renderer Fn="renderCheckBox "/>
</ext:CheckColumn>
var renderCheckBox = function (value, metaData, record, rowIndex, colIndex, store, view) {
if (record.get("otherbooleanfield") == 1) {
return "";
}
return someDefaultRenderingLogicOnCheckBox
// return "<input type='checkbox'" + (value ? "checked='checked'" : "") + ">"; works but returns a simple checkbox without CSS and does not look like other checkboxes in the grid
};
Last edited by hjh; Oct 25, 2013 at 12:43 PM.