Using Local Data in Server-Bound Grid Columns

2 posts, 0 answers
  1. Elisha
    Elisha avatar
    1 posts
    Member since:
    Aug 2017

    Posted 03 Aug 2017 Link to this post

    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.)

  2. Stefan
    Admin
    Stefan avatar
    3067 posts

    Posted 07 Aug 2017 Link to this post

    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.
Back to Top