I have a real problem for my application. Hopefully it is just a setting I overlooked. If I select a non-root item and collapse the branch it is on, it remains selected even though I selected another visible item without the using the shift or control keys. I have selected an item and collapsed its branch. Then I selected another item. When I expand the branch with the previously selected item, it is still selected. Visible selections are cleared with new selections, so hidden selections should be cleared with new selections.
What am I missing?
Thanks,
Paul
3 Answers, 1 is accepted
Thank you for contacting us.
I am not sure if I fully understand the problem but it sounds like you have enabled both multirow selection and toggle selection for the control. You can confirm if you observe the same behavior as in the following demo when the two configuration checkboxes are checked at the same time.
Client-side Selection
If this is so, check if you have set ClientSettings.Selecting.AllowToggleSelection to true and if so, set it to false.
If this is not the issue, you could record a screencast (using a tool like Jing) of how the treelist behaves on your side, and share your control declaration. This way it will be easier for us to identify the problem.
Kind regards,
Tsvetina
the Telerik team
The following code was used to setup the TreeList:
tlConfig.AutoGenerateColumns = False
tlConfig.DataKeyNames = {"LocnID"}
tlConfig.ParentDataKeyNames = {"ParentID"}
tlConfig.EditMode = TreeListEditMode.PopUp
tlConfig.Skin = "WebBlue"
tlConfig.AllowSorting = False
tlConfig.AllowMultiItemSelection = True
tlConfig.Height = Unit.Pixel(600)
tlConfig.ClientSettings.Scrolling.AllowScroll = True
tlConfig.ClientSettings.AllowPostBackOnItemClick = False
tlConfig.ClientSettings.Selecting.AllowItemSelection = True
tlConfig.ClientSettings.Selecting.AllowToggleSelection = False
tlConfig.ClientSettings.ClientEvents.OnItemSelected = "tcConfig_OnItemSelected"
tlConfig.ClientSettings.ClientEvents.OnItemDeselected = "tcConfig_OnItemDeselected"
tlConfig.ClientSettings.ClientEvents.OnItemDblClick = "tcConfig_onItemDblClick"
tlConfig.ClientSettings.ClientEvents.OnItemContextMenu = "tcConfig_onItemContextMenu"
Call SetTreeColumn(0, "Location", "RefDes", "RefDes", HorizontalAlign.Left, 150, False, ColumnTypes.Bound)
Call SetTreeColumn(1, "CommandColumn", "CommandColumn", "CommandColumn", HorizontalAlign.Center, 60, False, ColumnTypes.EditCommand)
Call SetTreeColumn(2, "Auditability", "Auditability", "Auditability", HorizontalAlign.Center, 100, False, ColumnTypes.CheckBox)
Call SetTreeColumn(3, "Accessibility", "Accessibility", "Accessibility", HorizontalAlign.Center, 100, False, ColumnTypes.CheckBox)
Call SetTreeColumn(4, "Adjacency", "Adjacency", "Adjacency", HorizontalAlign.Center, 100, False, ColumnTypes.CheckBox)
Call SetTreeColumn(5, "Description", "Description", "Description", HorizontalAlign.Left, 300, False, ColumnTypes.Bound)
Call SetTreeColumn(6, "Index", "Index", "Index", HorizontalAlign.Right, 60, True, ColumnTypes.Bound)
Multi-row selection is On and toggle selection is Off.
I’ve recorded the behavior in the following link:
http://screencast.com/t/6crrtoIVq
I don’t have a microphone, so here is what I did:
- Select LocnA1, then LocnA3 to demonstrate the LocnA1 will be deselected
- Select LocnA1 with the control key so both are selected
- Collapse LocnA
- Select LocnB2, no control or shift key
- Collapse LocnB
- Select LocnC2, no control or shift key
- Expanded LocnB and LocnA
- All hidden selections are still selected
Any idea on what is happening?
Now I understand what you mean, however this is expected behavior and here is an explanation why.
When you select some items from a root item's children and collapse it, you have a postback to the server and the item indexes are saved in the ViewState.
Then you expand another item and do client selection inside its children. Now the initially selected items are not available on the client and the client selection cannot deselect them.
When you again go to the server to expand the first item, its items are still selected, the newly selected ones, too, and as it comes to multiple selection that is fine.
If this is not the behavior that you want to observe, you would need to manually customize it by manipulating the SelectedIndexes collection of RadTreeList at the times when the control gets expanded/collapsed.
Kind regards,
Tsvetina
the Telerik team