EasyUI Forum
May 16, 2024, 05:53:50 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: how to append properties or event handler after parse  (Read 9542 times)
yulei
Newbie
*
Posts: 9


View Profile Email
« 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


});
 
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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){
//...
}
})
Logged
yulei
Newbie
*
Posts: 9


View Profile Email
« Reply #2 on: February 06, 2015, 01:30:24 AM »

it works! thank you!
(I worried about it may init twice before.  Smiley)


Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!