EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on January 29, 2016, 04:35:31 AM



Title: Defining options through data attribute
Post by: devnull on January 29, 2016, 04:35:31 AM
How can I define the data-options using javascript rather than through the html attribute "data-options" ?

http://jsfiddle.net/54v8nacp/31/



Title: Re: Defining options through data attribute
Post by: stworthy on January 29, 2016, 08:19:51 AM
Please try this:
http://jsfiddle.net/54v8nacp/32/


Title: Re: Defining options through data attribute
Post by: devnull on January 29, 2016, 03:57:26 PM
Thanks, so it is not possible to add these attributes using the jquery xxx.data() method so that they are not part of the visible html source code ?


I am trying to achieve this without converting the object to a string and embedding it inside the element's inner html.

I have used a different method: http://jsfiddle.net/54v8nacp/38/




Title: Re: Defining options through data attribute
Post by: stworthy on January 29, 2016, 06:51:18 PM
Override the $.parser.parse function, the example works as you desired.

http://jsfiddle.net/54v8nacp/39/

You also can download the patch from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4.4-patch.zip to get this feature.


Title: Re: Defining options through data attribute
Post by: devnull on January 29, 2016, 06:58:47 PM
Ooh. that's great, will this be added as a standard feature or only available through a patch ?


Title: Re: Defining options through data attribute
Post by: stworthy on January 30, 2016, 01:33:53 AM
This is a standard feature that will be included in next edition.