EasyUI Forum
April 27, 2024, 03:00:00 PM *
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 give dynamically created panels a unique id within the portal layout?  (Read 13711 times)
tslatt
Jr. Member
**
Posts: 85



View Profile
« on: August 02, 2011, 01:19:22 PM »

I am dynamically adding panels to the portal layout using the example provided in the demo:

Code:
//dynamically add widgets
function add(){
  //for 0-2 (add 3 widgets)
  for(var i=0; i<3; i++){
   
    //the new widget will be appended inside the <body>
    var p = $('<div><\/div>').appendTo('body');
   
    //create a panel (a widget)
    p.panel({
      title: 'Title ' + i,  //the widget's title (header)
      content: 'x',         //the widget's content (the box)
      closable: true,       //adds an 'X' control so the widget can be closed
      collapsible: true     //adds an "^" control so the widget can be collapsed/expanded
    });
   
    //add the new panel to the bottom of a portal column
    $('#cPortal').portal('add', { //it goes within the portal area #cPortal
      panel: p,                   //add the widget p specified above
      columnIndex: i              //add it after the last panel within column i (columns are numbered 0-1-2)
    });
  }   
}

How can I give each individual panel its own unique id?

I want each panel to have an id as a step towards saving the state of the portal (which panels are shown, in which columns, in which order). But if there is another way to get this info, please let me know...
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!