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

Expand/Collapse all selected rows GridGroupingControl

Hi,
 
 
Say I have a number of selected rows and I want to expand /collapse them all through lets say a right click action. What would be the code to expand/collapse only expanded range.
 
Thank you

10 Replies

GM Gaukhar Massabayeva March 4, 2013 12:59 PM UTC

Hi please let me know if my query is unclear. I will try to expand more. Thank you


GM Gaukhar Massabayeva March 5, 2013 09:45 AM UTC

Hello.
 
Anyone knows how to approach this?
 
At the moment here is what i am doing. I will describe how this is not a suitable solution below.
 
GridRangeInfoList range = this.gridControl.TableModel.Selections.GetSelectedRows(true, true);

foreach (GridRangeInfo info in range)
{
        if (info.IsRows)
        {
                    for (int i = info.Top; i <= info.Bottom; i++)
                    {
                         if (this.grdRawData.TableModel.GetDisplayElementAt(i) != null && this.grdRawData.TableModel.GetDisplayElementAt(i).GetRecord() != null)
                                   // attempt #1
                                   this.grdRawData.TableModel.GetDisplayElementAt(i).GetRecord().IsExpanded = true;
                                   // attempt #2
                                   this.grdRawData.TableModel.GetDisplayElementAt(i).GetRecord().SetExpanded(true, true, true);
                    }
                }
 
The problem with these two method is that they are both based on index and after expansion the nested tables takes place of indecies previously assigned to nth selected row.
 
To make it a bit clearer.
 
I have first 4 rows selected after I request expansion only first 2 get expanded.
 
Thank you
                          


AS Athiram S Syncfusion Team March 5, 2013 10:03 AM UTC

Hi Gaukar,

Thanks for your interest in Syncfusion Products.

You can expand or collapse a group and find some contents in it using the code:

http://www.syncfusion.com/downloads/Support/DirectTrac/62881/gridFindDialog_1be3e8c0_989f7d04324297770.zip

Please let me know if you have any concerns.

Regards,
Athiram S


GM Gaukhar Massabayeva March 5, 2013 11:45 AM UTC

Update:
 
I have tried to use
 
SelectedRecordsCollection range = this.grdRawData.Table.SelectedRecords;
foreach (SelectedRecord rec in range)
{
       rec.Record.IsExpanded = true;
}
 
SelectedRecords are empty, I digged into why this could be and found that for the record based selection to work I need to set TableOptions.ListBoxSelectionMode  to something other than None.
 
Now this is not desirable, because that would prevent me from selecting individual cells and this functionality is crucial in my application.
 
But out of curiousity I set TableOptions.ListBoxSelectionMode  to MultiSimple and tried to expand using that and alas SelectedRecords returned as empty.
 
Can someone replicate this?
 


AS Athiram S Syncfusion Team March 5, 2013 11:56 AM UTC

Hi Gaukar,

Sorry for inconvenience. I am afraid that I am  unable to reproduce the issue.

Kindly, attach a sample in order to reproduce the issue. This helps us to provide you with better support.

Regards,
Athiram S


GM Gaukhar Massabayeva March 5, 2013 12:05 PM UTC

Thank you for provided solution but i would rather not rely on index if possible.

I have provided a sample above I wonder if there is a way to do expansion based on selected records but avoiding using index.



GM Gaukhar Massabayeva March 6, 2013 02:09 PM UTC

The issue is now resolved thank you


AS Athiram S Syncfusion Team March 7, 2013 12:39 PM UTC

Hi Gaukar,

Thanks for your update.

We are glad to know that the issue if fixed at your end. If you face any other issues , please open a new forum.

Regards,

Athiram S



FB Felipe Bahiana Almeida September 27, 2013 04:24 PM UTC

would you please tell me how did you solve this issue? I am facing the same thing.

Thank you


AS Athiram S Syncfusion Team October 7, 2013 03:51 AM UTC

Hi  Felipe,

Would you please give us a sample where you face this issue, so that we can sort out the issue and solve it for you.

Please let me know if you have any concerns.

Regards,
Athiram S

Loader.
Live Chat Icon For mobile
Up arrow icon