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

TreeList.Selectable(true)

2 Answers 34 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Veteran
Iron
Iron
Joel asked on 20 Mar 2019, 07:31 PM

Explain to me how I can work with the Selectable option.  I have 2 controls on a page.  On the left, I have a TreeList and on the right I have a Grid.  The TreeList contains a hierarchical list of groups for which the user is authorized.  I'm going to use this group selection to "filter" the data that will be displayed in the Grid control.  So, I need the selection of a group in the TreeList to prompt the refresh of the Grid which then must use the groupId of the selected TreeList's node.

  1. On load, how can selection of a TreeList Node be set to a default group from a MVC Action? 
  2. On selection, how can this value fire an event that will reload the Grid?

An example would be appreciated.  Thanks for your help,

Joel

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 25 Mar 2019, 12:17 PM
Hello Joel,

In order to have an item in the TreeList selected initially I would suggest returning the ID for the item in ViewData. Then use JavaScript to retrieve the data as illustrated in this stackoverflow thread. With that ID you can get the dataItem and the respective row element. Selecting the row would be straight forward with the select method. This part is illustrated in the dojo below. The relevant JavaScript code is applicable also for the .NET Core wrapper.


Regarding the items in the Grid. You can specify Data method for the Read action and send the ID for the selected TreeList row to the server. Thus, only the relevant records would be requested and returned to the Grid. The article below describes sending additional information to the ActionMethod: 



For refreshing the Grid when the users select a different item in the TreeList handle the change event for the widget. In the event handler get reference of the Grid DataSource and call its read() method


Regards,
Viktor Tachev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Joel
Top achievements
Rank 1
Veteran
Iron
Iron
answered on 25 Mar 2019, 07:10 PM
I'll give this a try.  Thanks.
Tags
TreeList
Asked by
Joel
Top achievements
Rank 1
Veteran
Iron
Iron
Answers by
Viktor Tachev
Telerik team
Joel
Top achievements
Rank 1
Veteran
Iron
Iron
Share this question
or