We need to accomplish 2 things with an igHierarchicalGrid.
1. Based upon one of the values in a row, we want to show/hide the expand/collapse character. For example. For row one I know there are no children, therefore I don't want to show the expand character (this is different from returning FALSE when the row is actually expanded, i.e. I don't even want to see the expand character). For the second row I know there are children, therefore, I want to see the expand character.
2. When a row expands to show the child grid, I want to hide certain columns in the child grid. But for a different parent row I may want to hide different columns in the child grid. However, both are using the same defined child grid.
Hello hrwebb,
In answer to your questions:
1. You may find the element that renders the expand indicator and set it css property: display:none. For example: $(".ui-iggrid-expandbuttoncontainer").eq(0).css("display", "none") This could be achieved on some event, for instance grid rendered event.
2. Hiding certain child grid columns could be achieved on rowExpanding or rowExpanded event. You may also enable Selection, so that you can get information about the selected parent row and hide the child grid columns based on it.
Please let me know if you have any further questions.
Regards,
Tsanna
Thank you for your response.
However,won't item 1 change the expand indicator for the entire grid? I need to be able to do it row by row. One child row may show the expand indicator, while the next will now.
I will give item 2 a try.
Please note that when certain parent row does not have children, the expand indicator by default does not show. So you don't have to hide it explicitly.
When the hierarchical grid is instantiated we will define 3 levels - the root with an associated child grid. The child grid will have its own child grid associated with it.
When a root record is expanded to show its child grid, we want some of the child rows to expose the expand icon (to be able to expand the child row to view its children) while others will not. We will know which ones should or shouldn't based upon a hidden value associated with the child row. Since at instantiation we have included a third level, every row of the child grid associated with the root would normally show the expand icon. In this chase, it's not until you expand some rows that you learn they have no children.
The following demonstrates what we need to accomplish.
Root row
Level 1 child (no children so icon not displayed)
- Level 1 child (has children)
Level 2 child
Did you read my previous post? I created a sample based on your explanation and grid structure for your reference. Please note that the child rows that have no child record do not render expansion icon. Attached is the sample for your reference. If I misunderstood your requirement, please feel free to modify the sample and send it back to me.
I didn't realize it would make a difference, but I think I left out one very important piece of information - We are using Load On Demand and only load the root level when the grid is instantiated. The grid includes a child grid for each root row and we define a third child grid to be populated when any child row of a root row is expanded.
I think this means that if any item at the root level is expanded, the Infragistics code will assume each child row of each root row will have children, so the expand icon is displayed since it cannot be determined at this point whether the child has any children of its own (until the row is expanded and the igchildgridcreating event is executed.
However, we will include a data value for each child row of the root that will tell us whether or not there are additional children. We want to use this value to hide the expand icon for the applicable row and ensure it cannot be expanded.
I believe we determined how to do this. In the attached code, the dataRendered event for the first child level checks for a specific value in the data record, hides the expand icon, and disables the record from being expanded even if the user clicks in the expanded column cell.
You can see this by expanding the Food record. The child record having Name = 'Milk' has no visible expand column and clicking the expand cell causes no action.
Yes, having a load on demand functionality makes a difference in this case. However I'm glad that you were able to resolve your issue. If I can provide you with further assistance, please let me know.
Regards,Tsanna