I want to disable addition, deletion, and edition in a hierarchical grid. This works fine for the first level of the grid:
$("#MyGrid").igGridUpdating("option", "enableAddRow", false); $("#MyGrid").igGridUpdating("option", "enableDeleteRow", false); $("#MyGrid").igGridUpdating("option", "editMode", "none");
but child rows still can be edited. How to disable that options en the second level even if the parent rows are not expanded?
Please don't forget my last question ;)
Sorry for the delay, I am back. Your answer is ok but, how to do that after initialization? I've tried this with no success:
$.each($("#MyGrid").igHierarchicalGrid("allChildren"), function () { $(this.igGrid).igGridUpdating("option", "enableAddRow", false); $(this.igGrid).igGridUpdating("option", "enableDeleteRow", false); $(this.igGrid).igGridUpdating("option", "editMode", "none"); });
And this:
$("#MyGrid").igHierarchicalGrid("option", "enableAddRow", false); $("#MyGrid").igHierarchicalGrid("option", "enableDeleteRow", false); $("#MyGrid").igHierarchicalGrid("option", "editMode", "none");
Hello Luis,
Please let me know if you need any further assistance with this matter.
Thank you for posting in our community.
By design igHierarchicakgrid is not editable until you enable the Updating feature. This means that if you do not enable Updating explicitly users are not going to be able to add, delete or edit rows in both parent and child levels.
However, if you would like to disable editing from the Updating feature you could set the the enableDeleteRow and enableAddRow to false and editMode to none. For example:
$("#hierarchicalGrid").igHierarchicalGrid({ width: "100%", dataSource: data, autoGenerateLayouts: false, autoGenerateColumns: false, columns: [ { key: "Name", headerText: "Name", dataType: "string" } ], features: [ { name: "Updating", editMode:"none", enableAddRow: false, enableDeleteRow: false, } ], defaultChildrenDataProperty: "Products", columnLayouts: [ { name: "Products", childrenDataProperty: "Products", autoGenerateColumns: false, columns: [ { key: "Quantity", headerText: "Quantity", dataType: "number" }, { key: "Name", headerText: "Name", dataType: "string" } ], features: [ { name: "Updating", editMode: "none", enableAddRow: false, enableDeleteRow: false, } ] } ] });
$("#hierarchicalGrid").igHierarchicalGrid({
width: "100%",
dataSource: data,
autoGenerateLayouts: false,
autoGenerateColumns: false,
columns: [
{
key: "Name",
headerText: "Name",
dataType: "string"
}
],
features: [
name: "Updating",
editMode:"none",
enableAddRow: false,
enableDeleteRow: false,
defaultChildrenDataProperty: "Products",
columnLayouts: [
name: "Products",
childrenDataProperty: "Products",
key: "Quantity",
headerText: "Quantity",
dataType: "number"
},
editMode: "none",
]
});
I hope this will help you achieve your requirement.
I also created a small sample illustrating my suggestion and I am attaching it for your reference.