We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Hierarchical grid?

In the hierarchical grid is there any way to prevent the expanding of certain rows? I'd like to allow only child grids with two or more rows to be expandable. Removing the CSS class "MasterCellCollapse" seems to have some side effects. Is there a proper means to accomplish what I want?


6 Replies

ES Eswari S Syncfusion Team December 21, 2011 08:47 AM UTC

Hi Greg,

Thank you for using Syncfusion products.

Query #1 : In the hierarchical grid is there any way to prevent the expanding of certain rows?

We can prevent the expanding of the rows in hierarchical grid by handling OnRecordExpanding event. Please refer to the following code snippets:

<%=Html.Syncfusion().Grid("GridSrc")
. . . . .
.ClientSideEvents(eve =>
{
eve.OnRecordExpanding("OnExpanding");
})
.ChildGrid(child =>
{
. . . . .
.ToChildGridTemplate());
})
%>


[JavaScript]



For your convenience , we have prepared the sample and the same can be downloaded from the following link:

Sample397622127.zip

Note: If you want to run the sample in MVC3, change the configuration manager as Debug_MVC3/Release_MVC3.To briefly know about that steps please kindly refer this document link.

How to Switch between MVC2 to MVC3

Query #2 : I'd like to allow only child grids with two or more rows to be expandable.

In your scenario , we need to get the child record count to cancel the expanding of record. We cannot get the child records count in expanding event. We can only get the record count of child grid after expanding.

Please let us know if you have any other queries.

Regards,
Eswari.S





GC Greg Clouston January 5, 2012 02:15 PM UTC

Thanks for the information. With the data I have I know whether or not the child grid will have more than one record in it or not. My question to you is: Can I turn off the hierarchical grid on a row by row basis?



RR Ranjithkumar R G Syncfusion Team January 10, 2012 11:54 AM UTC

Hi Greg,

Thanks for your update.

We would like to like to let you know that we can disable the expanding of particular rows in the client side row expanding event by specifying the id of the rows. We don't have separate property to turn off the hierarchy. We suggest you to specify the id's which you need not to expand . Please refer to the code snippet below.

[JavaScript]



Please refer to the below link to download the sample application.

http://www.syncfusion.com/downloads/Support/DirectTrac/88902/Sample388765696.zip

Please let me know if you have any concern.

Regards,
Ranjithkumar




GC Greg Clouston January 11, 2012 06:41 PM UTC

Thanks for the sample project. With your help I was able to add the expanding cell suppression to our project.

One more question for you. Is there any way to change the icon in the expand collapse column? I'd like to differentiate between a row that can be expanded and one that can't be.



GC Greg Clouston January 16, 2012 08:54 PM UTC

Any movement on this issue? Do I need to file a support ticket?



RR Ranjithkumar R G Syncfusion Team January 18, 2012 02:06 PM UTC

Hi Greg,

Thanks for your update.

We would like to let you know that it is not possible to change the expand/ collapse image in the hierarchical grid based on some condition.

Please let us know if you have any concern.

Regards,
Ranjithkumar.


Loader.
Live Chat Icon For mobile
Up arrow icon