Hi,
I'm working with iggrid in mvc. I have a grid with checkbox and this checkbox should be readonly if match count is > 0.
MODEL:
MatchCount
IsActive
GRID:
@Html.Infragistics().Grid(Model)
$(document).delegate("#sales-last-grid", "iggriddatarendered", function (evt, ui) {
gridRendered(evt, ui);
});
JAVASCRIPT:
gridRendered(evt, ui){
// Here I want to check the readonly status by match count. What I did is:
var grid = $("#grid");
var dataview = grid.data('igGrid').dataSource.dataView();
dataview.forEach(function (obj, index) {
if (obj.MatchCount == 0) {
???? HERE I DONT KNOW HOW TO MODIFY READONLY VALUE
}
Hello,
Thank you for contacting Infragistics!
If you want to make an entire column read only/un- editable you would adjust the column settings of the Updating feature:
http://www.igniteui.com/help/api/2016.2/ui.iggridupdating#options:columnSettings.readOnly
If you want to make only a single cell or checkbox read only you would instead handle editing events or value changing events. For making a cell, row, or built in checkbox un-editable you would handle editCellStarting or editRowStarting and return false to cancel entering edit mode:
http://www.igniteui.com/help/api/2016.2/ui.iggridupdating#events:editCellStarting
http://www.igniteui.com/help/api/2016.2/ui.iggridupdating#events:editRowStarting
For a templated checkbox you would want to handle the valueChanging event of the templated checkbox and cancel that instead.
Hi Mike,
Thank you for your reply, but that doesn't help much.
My question is:
The checkbox should be readonly if match count is > 0 mean depend on the other value of the column. And how to switch it to readonly
- NOT an entire column
- NOT only a single cell
- MAYBE a templated checkbox but how to do it?
My Grid
MatchCount Checkbox
0 readonly because MatchCount = 0
1 not readonly because MatchCount > 0
You have to check the MatchCount for each column and render the checkbox readonly or not
You will see code examples in my question and I'm waiting for a code example.
Thank you