This is a migrated thread and some comments may be shown as answers.
Using Local Data in Server-Bound Grid Columns
1 Answer 9 Views
This is a migrated thread and some comments may be shown as answers.
Elisha
Top achievements
Rank 1
Elisha asked on 03 Aug 2017, 09:31 PM

Ok, so I have a bit of a quandary...I'm creating a Grid with dynamic columns. Additionally, data for these columns may come in with a variety of names. For instance, the user may want a column that is labeled 'Name', but the underlying data may have any of these keys: 'name', 'label', or 'title'

'name', 'label', 'title' => 'Name'

The data coming into the grid could have a structure something like this:

data = [{'metaData': {'data': [{'theKey': 'label', 'theValue': 'alfred'}]}}, {'metaData': {'data': [{'theKey': 'title', 'theValue': 'jameson'}]}}, {'metaData': {'data': [{'theKey': 'name', 'theValue': 'Renee'}]}}, {'metaData': {'data': [{'theKey': 'label', 'theValue': 'trisha'}]}}]

For this example, the result I would like for a single column 'Name' would be: 'alfred', 'jameson', 'Renee', 'trisha'

I've tried passing local data to a server-bound template. (Please refer to attachment) Unfortunately this seems to result in the template becoming locally bound.

Are there any other solutions? Perhaps I could call 2 datasources for a single column (1 for the column mappings and another for the data), but I'm not sure if this would solve any issues. 

Thank you!

(I'm doing this in a JavaScript/React app, so I don't have direct access to the DOM.)

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 07 Aug 2017, 11:41 AM
Hello Elisha,

Thank you for the provided information.

For the server-bound template- Please have in mind that the kendo.template() will be executed only on the client.

In this scenario, I can suggest using the schema.parse function of the dataSource:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.parse

I made an example based on the provided data to demonstrate how it can be parsed:

http://dojo.telerik.com/INIsOx

I hope this is helpful.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Elisha
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or