Hi,
I have a hierarchical grid where I will be expanding all the rows during form load using below code:
_expandAllRowsOfGrid =function () {
hGrid = _$displayTitleAndFootageGrid.igHierarchicalGrid("rootWidget");
$(hGrid.allRows()).each(function (index, element) {
_$displayTitleAndFootageGrid.igHierarchicalGrid("expand", element);
});
}
How will I capture if all the rows are expanded?
Thanks,
Kiran
Hello Kiran,
Thank you for posting in our forums!
If you are expanding all the rows in the igHierarchicalGrid when it is loaded, I would recommend you to set the initialExpandDepth option of the igHierarchicalGrid. This will cause each column layout up to the specified depth to be expanded when the grid renders. You can find more information on this option here:
http://help.infragistics.com/jQuery/2014.1/ui.ighierarchicalgrid#options:initialExpandDepth
If you need further assistance with this, please let me know and I will be glad to help.
Hi Michael,
I tried to use the below line after binding data to the grid getting the javascript error as shown in second line.
var accessibility = $("#predisplaySubgroupAndDisplayGrid").igHierarchicalGrid("option", "initialExpandDepth");
0x800a139e - JavaScript runtime error: cannot call methods on igHierarchicalGrid prior to initialization; attempted to call method 'option
Can you please let us know how do we capture the event if all the child rows are expanded? Am I making any mistake in accessing the initial depth?
Thank you for the update.
From the information available to me, that code looks fine. Please note that that current code will return the initialExpandDepth option, rather than setting it. When are you calling that line that you are receiving that error with? Are you calling it during one of the igHierarchicalGrid's events or after the grid has been initialized?
The igHierarchicalGrid does not have an event for when all rows have been expanded. You would have to check each child row individually.
Instead, I suggested setting the initialExpandDepth option since each row should be expanded after the grid's initialization if you have the initialExpandDepth option set high enough for each of your columnLayouts.
To better assist you, could you please detail for me what you are trying to accomplish that you need to know when all rows are expanded?
Looking forward to hearing from you.
PFA code sample, Below is what we are looking for
1. We have to show a loader/ spinner to the user so that when grid rows are expanding user should be notified that some process/activity is happening.
We are thinking of showing a loader and hide it once all the rows are expanded.
2. If you see in rows rendered event we have the below code snippet:
$(".disableSelectedDisplay").each(function () {
$(this).prop("disabled", "disabled");
This is not at all being triggered, we have a requirement that if any of the checkbox the above mentioned class is set and the checkbox is checked during load itself we have to disable all the checkboxes. So after rows expanded event planning to call above code snippet and alter it to disable all the checkboxes.
Thanks in advance for your support.
Thank you for the sample!
After some research, I have found the following forum thread where Martin provides some code that can be called to recursively expand all the rows in the grid. You could use the following code Martin provided instead of setting the initialExpandDepth option.
http://ko.infragistics.com/community/forums/t/88627.aspx
I have modified and reattached your sample to include Martin's method of expanding all the rows in the grid. During the if/else statement in the expandAllRows() function, this is where all the rows are considered to be expanded. I have added the following code to fire at this section of code:
$("#loadingIndicator").hide();$(".disableSelectedDisplay").each(function () { $(this).prop("disabled", "disabled");});
If you have any questions or concerns with this, please let me know and I will be glad to help.
Please let me know if you need further assistance with this issue.