Hello,
I have a 3-level igHierarchicalGrid in an MVC project which is loaded on demand using a JsonResult. Only the first level is loaded initially, and the data for the second (and third) levels is loaded only when the expansion indicator (+) is clicked for the relevant row.
However, there may not be data for the second and/or third level - on each level i have a count records for the next level, and if this count is 0 I would like to hide the Expansion (+) indicator for the next level.
Is this possible, and how would you do it?
Hello Deon,
Thank you for posting in the community.
I am currently looking into you issue and I will need some more time to investigate your requirement further. I will keep you posted on my progress and I will get back to you soon with more information or questions for you.
Please feel free to continue sending updates to this case at any time.
Thank you for your patience.
I investigated your requirement further and what I can suggest is handling the RowExpanding event of the igHierarchicalGrid. In this event you could check whether the child grid for this particular level has any row and if there is no rows to hide the span element that holds the "+" sign. For example:
$("#hierarchicalGrid").live("ighierarchicalgridrowexpanding", function (evt, ui) { if (Your condition here) { $(args.parentrow.find("span")[0]).hide(); $('#' + id).hide(); } });
$("#hierarchicalGrid").live("ighierarchicalgridrowexpanding", function (evt, ui) {
if (Your condition here) {
$(args.parentrow.find("span")[0]).hide();
$('#' + id).hide();
}
});
Alternatively, in this event you could access the child of the row being expanded, check the number of rows in this child grid and if there is no rows to hide the span element as such:
$("#hierarchicalGrid").live("ighierarchicalgridrowexpanding", function (evt, ui) { var childGrid = args.parentrow.next().find("table.ui-iggrid-table"); var id = $(childGrid).attr("id"); var rows = $('#' + id).igGrid("rows"); if (rows.length == 0) { $(args.parentrow.find("span")[0]).hide(); $('#' + id).hide(); } });
var childGrid = args.parentrow.next().find("table.ui-iggrid-table");
var id = $(childGrid).attr("id");
var rows = $('#' + id).igGrid("rows");
if (rows.length == 0) {
I hope you find this information helpful.
Please let me know if you have any additional questions regarding this issue.