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

Possible to get access to DataTextField on Expand?

1 Answer 54 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
axwack
Top achievements
Rank 1
axwack asked on 07 Feb 2016, 03:22 PM

I could have a very n-deep treeview but the way the dataTextfield operates solves my problem. Is it possible, when the node is expanded, that you modify the array for which the dataTextField is displayed?

 For example:

 When the call is made to the service, the JSON Object return is:

The first node name should be : VBN

so the dataTextField: [SSM.securitySelectionModelName]

 

{"id": 1, "isSSMNameNode": true, "tgtWeight": 0.0, "currWeight": 0.0, "hasChildNode": true, "ext_model_id": 1, "parent": null, "SSM": {"id": 1, "securitySelectionModelName": "VBN"}

 

On the next get, it should be ["SSM.securitySelectionModelName", "SSM.classificationName]"

[{"id": 2, "isSSMNameNode": false, "tgtWeight": 0.0, "currWeight": 0.0, "hasChildNode": true, "ext_model_id": 14, "parent": {"id": 1, "isSSMNameNode": true, "tgtWeight": 0.0, "currWeight": 0.0, "hasChildNode": true, "ext_model_id": 1, "parent": null, "SSM": 1, "classificationNameNode": null}, "SSM": {"id": 1, "securitySelectionModelName": "VBN", "classificationNameNode": {"id": 14, "classificationLevel": 2, "classificationName": "MBS", "hasChildNode": false, "parent": 2}}]

 Is this possible to do on the expand event where I create the dataTextField array dynamically?

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 11 Feb 2016, 03:51 PM

Hello axwack,

 

As far as I understand your response for the root items and child items is different and you want to change the dataTextField configuration field. I am afraid that this can not be achieved without destroying and initializing the widget with the new setting (dataTextField option). 

 

My suggestion is either to unify the responses to be in same format or change the response before passing it to the Kendo UI DataSource. The schema.parse  method should work for this case. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeView
Asked by
axwack
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or