I am using ig-heirachial grid .(Infragistic-2015). I want to make the child cell disable(readonly) based on Parent row cell value. suppose in below image ShiptoNo is 101 .So if the cell value of 2014 column less than the value of Shipto No then the cell should be Disable(readony). If we will change the Shipto No value ..the cell value of 2024 column which is less than shipto no value should be disable .
Is there any possible solution around .??
Hello Sunil,
I am working on making sample for make child cell disable dynamically basedon parent value and will provide you an update by tommorow EOD.
I am looking into the requirement and what I understand is based on “ship to” parent cell value you want to disable (read only) “2014” child cell value. But I don’t understand where is column “2024” as you mentioned?
Hi Divya,
I am sorry.that is 2014 column only .2024 is a mistake
Regards,
Sunil
Using igHierarchicalGrid making the child cell disable dynamically when you compare the value with parent cell
I have made a sample allowed the cells to be read only if the value in the parent is greater than the child cell’s value. In the sample you can see that I handle the editCellStarting event for the child grid in columnLayouts. I use DOM traversal with jQuery to get the parent row of the child grid. I get the data-id of the parent row, which the igGrid uses to store each row’s primaryKey. With the primary key, I can call findRecordByKey to get the data for that row which allows me to compare the value of the parent cell with the cell entering edit mode. As usual, you can then use return false to cancel the editing.
Code snippet:
features: [ { name: 'Updating', enableAddRow: false, enableDeleteRow: false, editCellStarting: function(evt, ui) { var parentTR, parentRowId, parentRow; if (ui.columnKey != "UnitPrice") return;
// Get data for this cell's parent row. parentTR = ui.owner.grid.element.closest("tr").prev(); parentRowId = $(parentTR).data('id'); parentRowData = parentTR.closest("table").igGrid('findRecordByKey', parentRowId);
// Compare the parent row's value to this cell's value. Return false to prevent the user from editing the cell. if (ui.value < parentRowData.Cost) { return false; } } } ],
Please find the attached sample.