I have set the "required" property for columns in the columnSettings dynamically during initialization. When loading the igGrid (and adding a new row), I want to indicate those required fields with the cell colored in red. How can I do that?
Thanks!
hi Erica,
The editor options provide you with the functionality to set a custom theme.
Using the following code:
editorOptions: { theme: 'requiredCell' }
you may specify editor options for the columns that are required.
You may use also the following CSS to mark the cell with red border:
.requiredCell {border: 1px solid red !important;}
Hope that helps. Let me know if you are unable to use my comments and/or you need a specific sample.
regards
Lyubo
The cell is set to red depending on the columnSetting.required property value. Where should this logic be applied?
Can I have a sample specific for this?
I've modified the sample.
It now uses the dataRendering event to attach to each required cell dynamically a template that will paint the cell in red.
This will ensure that the grid has cells in red not only in editing mode. I'm not sure that I understand your request about the "first time",
so you may add another variable and place an IF statement that dataRendering event will add templates in a specific case.
Please let me know if that helps.
Regards
Thanks Lyubo. Adding template as suggested works well with a text column. However, color does not show if the column contains a checkbox and a text of "<span style...>" was shown instead.
Please find the attached screenshot for the expected result that I want to achieve from your advice and the current behaviour with your suggested template.
I'm sorry, I've provided you with a wrong code for the template. It should be looking like this:
col.template = "<div class='requiredCell'>${" + col.key + "}</div>";
Please check the new attachment and let me know if you have any questions.
I already did the same:
var template = "<div class='requiredCell'>${" + column.key + "}</div>";
column.template = template;
But it displays differently for a checkbox column.
Any updates on this?
Did you check the attachment and see how it's working with a checkbox column?