EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: tslatt on November 22, 2011, 10:35:28 AM



Title: Using "live" with panel events?
Post by: tslatt on November 22, 2011, 10:35:28 AM
How can I use "live" with this code? I want to set up events on panels that exist now and in the future, as I dynamically add more panels later.

Code:
//add events to all panels
$(".easyui-panel").each(function(index) {//for all panels
  $(this).panel({//for this panel

    onLoad: function() {//do this when a panel's href is loaded (ajax)
      //my actions here
    },//end on panel ajax load

    onClose: function() {//do this on panel close
      //my actions here
    },//end on panel close

    onCollapse: function() {//do this on panel expand
      //my actions here
    },//end on panel collapse

    onExpand: function() {//do this on panel expand
      //my actions here
    },//end on panel expand

    onMaximize: function() {//do this on panel maximize
      //my actions here
    },//end on panel maximize

    onRestore: function() {//do this on panel restore (unmaximized)
      //my actions here
    },//end on panel restore (unmaximized)

    onResize: function(width, height) {//do this on panel move/resize
      //my actions here
    }//end on panel move/resize

  });//end for this panel
});//end for all panels
//end add events to all panels

Any help would be greatly appreciated.