Doug Black
Posts: 0
Joined: Wed Aug 14, 2013 11:36 am

Sliding Panel Questions

I followed the sliding panel tutorial, and it works fantastic!

I have two sliding panel questions:

1) How do I put two different sliding panels on the same Page?

2) How can I update Label text information on the sliding panel? I had created the Label no problem; however, I want it to read the text from a localStorage variable.

Thanks!

Doug Black
Posts: 0
Joined: Wed Aug 14, 2013 11:36 am

Sliding Panel Questions

Actually, disregard #1. Just got the multiple panels to work!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Sliding Panel Questions

Hi Doug,

Let's do the following example.

Custom JavaScript code:prevar Panel = function(id) {
var that = {},
_panel = $(id);

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

_panel.on("panelbeforeopen", function( event, ui ) {
$(".view_alert").die().live("click", function() {
alert("view alert")
});

Code: Select all

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

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

return that;
};/pre
Component HTML code:precode
<div data-role="panel" data-position="right" id="mypanel" data-display="overlay" data-theme="a">
<a data-role="button" class="view_alert">View Alert<&#47;a>
<a data-role="button" class="close_panel">Close<&#47;a>
<&#47;div>/code/preFor every Panel you should set its own mypanel (we'll use mypanel and mypanel2).

On Page Load run the following code:prepanel = new Panel("#mypanel");
panel2 = new Panel("#mypanel2");/pre
Then call the Panel: on button click add panel.open(), or panel2.open(), accordingly.

Doug Black
Posts: 0
Joined: Wed Aug 14, 2013 11:36 am

Sliding Panel Questions

That's awesome, thank you!

How about the labels from localStorage on the sliding panel?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Sliding Panel Questions

Doug,

Add a Label to SlidePanel: precode<label id="mylabel">sample text<label>/code/pre
Then paste your value into it:
pre$("#mylabel")&#46;text(localStorage&#46;getItem("myValue"));/pre
where myValue is your variable name

Doug Black
Posts: 0
Joined: Wed Aug 14, 2013 11:36 am

Sliding Panel Questions

Perfect, thank you!

My Teamers
Posts: 0
Joined: Wed Mar 12, 2014 10:09 am

Sliding Panel Questions

Hi,

Where is the "sliding panel tutorial" that you spoke about in your original post please?

thanks

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Sliding Panel Questions

Hello! Please take a look here http://docs.appery.io/documentation/u... (Panel section)

My Teamers
Posts: 0
Joined: Wed Mar 12, 2014 10:09 am

Sliding Panel Questions

Hi,

That's where I looked, and I have attached the panel to my UI (and added a button and text field) but i do not see it in the web preview nor on my phone.

thanks

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Sliding Panel Questions

You need to open Panel on some event (for example button click).

Return to “Issues”