EasyUI Forum

General Category => General Discussion => Topic started by: yulei on February 04, 2015, 04:35:57 AM



Title: how to append properties or event handler after parse
Post by: yulei on February 04, 2015, 04:35:57 AM
I am a newer to easyui.

I like markup type to define widget like this:
Code:
<div id='tt' class="easyui-tabs" style="width:700px;height:250px" data-options="...">
<div title="APanel"  ></div>
<div title="BPanel"  ></div>
<div title="CPanel" ></div>
</div>


I know the basic way to handle events is write a javascript method in the data-options.
it seems not easy to wirte an javascript function in a html attribute with other options as a long string.
May i add an event handler and ohter options to the markuped  widget  by javascript in $(document).ready functions  after parse?

just like this (some thing i imagine) :

Code:
$(document).ready(function() {

  $('#tt').tabs.('options','fit',true);// set the options

  $('#tt').tabs.('event','select',function(){
          xxx
  }); //set the event


});
 


Title: Re: how to append properties or event handler after parse
Post by: stworthy on February 04, 2015, 07:20:19 PM
Please try the code below to change the tabs options.
Code:
$('#tt').tabs({
fit:true,
onSelect:function(title,index){
//...
}
})


Title: Re: how to append properties or event handler after parse
Post by: yulei on February 06, 2015, 01:30:24 AM
it works! thank you!
(I worried about it may init twice before.  :))