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

Using data-attributes to create that takes an object inside an option

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
tahmed
Top achievements
Rank 1
tahmed asked on 15 Mar 2013, 12:25 AM
I want to change the grid initialization from javascript to use mostly data attributes

In my js I have the following:
filterable: {
 name: "FilterMenu",
 extra: true,
 messages: {
  isTrue: "On",
  isFalse: "Off"
  }
},
How do I move it to a data attribute?

I have the following now but how do I fill in the messages part?
data-filterable='{
        "name" : "FilterMenu",
        "extra" : "true",
        "messages" : "{
        }"
    }'

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 18 Mar 2013, 01:54 PM
Hi Sudhir,

Basically you should transform the JavaScript object into a valid Json.
data-filterable='{
    "name" : "FilterMenu",
    "extra" : "true",
    "messages" : {
        "isTrue": "On",
        "isFalse": "Off"
    }
}'

I hope this will help.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
tahmed
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or