This is a migrated thread and some comments may be shown as answers.

Collapse All but edited item in grouped grid

2 Answers 42 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 13 Aug 2010, 07:26 PM
I have a little knowledge base with books and chapters. It is grouped by Book, and the chapters are editable. Not the books.

By default I have all the columns set to collapse on load.
Whenever i edit an item in a chapter and click Update (or cancel)  The grid reloads with ALL the Items expanded.
I have tried a few samples handling this in the ItemCommand event, but none have worked.

On save or cancel, i would like it to collape all except the currently edited and expanded book.
How can i do that with the grouping ?

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 19 Aug 2010, 02:26 PM
Hello David,

I attached a runnable project that illustrates how to achieve the desired functionality.

I hope this helps.

Best regards,
Daniel
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
David
Top achievements
Rank 1
answered on 27 Aug 2010, 03:47 PM
That did what i wanted !  i would nevr have fiogured that out. thank you SO much !!
I added the same index the cancel button and all is perfect.


Here it is in VB

Protected Sub rgFolders_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)
     If TypeOf e.Item Is GridGroupHeaderItem Then
         If Not [String].IsNullOrEmpty(itemIndex) AndAlso e.Item.GroupIndex = itemIndex.Split("_"c)(0) Then
             e.Item.Expanded = True
         Else
             e.Item.Expanded = False
         End If
     End If
 End Sub
 Protected Sub rgFolders_ItemCommand(ByVal [source] As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
     If e.CommandName = RadGrid.UpdateCommandName Then
         itemIndex = (DirectCast((e.Item), GridEditFormItem)).ParentItem.GroupIndex
     End If
     If e.CommandName = RadGrid.EditCommandName Then
         itemIndex = e.Item.GroupIndex
     End If
     If e.CommandName = RadGrid.CancelCommandName Then
         itemIndex = (DirectCast((e.Item), GridEditFormItem)).ParentItem.GroupIndex
     End If
 End Sub
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Daniel
Telerik team
David
Top achievements
Rank 1
Share this question
or