Page 1 of 1

Nested Panels

Posted: Mon Jan 20, 2014 6:50 pm
by Michael Iverson

A couple of days ago, I finished working on the panel tutorial, and it worked great. I have been working lately on making a nested panel. For example, I have one button in the first panel, that once the user click on it, another panel, on the same side, will appear. Is there any way to attack this? I am stuck.

Thanks

Michael


Nested Panels

Posted: Mon Jan 20, 2014 7:36 pm
by Maryna Brodina

Hello! Not sure I understand what do you mean. Have you tried new Panel component http://docs.appery.io/documentation/u...?


Nested Panels

Posted: Mon Jan 20, 2014 7:39 pm
by Michael Iverson

Yes,

Code: Select all

 However,  Let's say I add a button to the panel.  This button will open a new panel, on the same side. 

Michael


Nested Panels

Posted: Mon Jan 20, 2014 7:42 pm
by Michael Iverson

Yes,

However, Let's say I add a button to the panel. This button will open a new panel, on the same side.

Michael


Nested Panels

Posted: Mon Jan 20, 2014 8:59 pm
by Maryna Brodina

You can add action of panel opening on button click. This panel will close, but new one open.


Nested Panels

Posted: Tue Jan 21, 2014 7:07 pm
by Michael Iverson

Image

When you click the 'New Panel' button, a new panel will be loaded in place of the old. I cannot figure out the code to do this. Below is my attempt to do this with js/jquery:

precode
var Panel = function() {
var that = {},
_panel = $('#mypanel');

Code: Select all

 var page = _panel.parents("[data-role=page]"); 
 page.append(_panel); 

 if (_panel == $('#mypanel')) { 
     _panel.on("panelbeforeopen", function(event, ui) { 

         $("#close_panel").die().live("click", function() { 
             that.close(); 
         }); 
         $("#new_panel").on("click", function() { 
             that.change(); 
         }); 
     }); 
 } else if (_panel == $('#mypanel2')) 
 { 
     _panel.on("panelbeforeopen", function(event, ui) { 

         $("#close_panel").die().live("click", function() { 
             that.close(); 
         }); 
     }); 

 } 

 that.open = function() { 
     _panel.panel('open'); 
 }; 
 that.close = function() { 
     _panel.panel("close"); 
 }; 

 that.change = function() { 
     _panel.empty().remove(); 
     _panel = $('#mypanel2'); 
     page = _panel.parents("[data-role=page]"); 
     page.append(_panel); 
     _panel.panel('open'); 
 }; 
 return that; 

};
/code/pre


Nested Panels

Posted: Tue Jan 21, 2014 8:03 pm
by Kateryna Grynko

Hi Michael,

Try our new component that is much more easier and you won't need any JS: http://docs.appery.io/documentation/u...