Page 1 of 1

Dynamic header

Posted: Thu Apr 18, 2013 6:15 pm
by Andrés Méndez

Hello.

I want to put the text header based on a data from database.

I have tried to put a Label inside the header, but it doesn't allow me to do that.

How can I do that?

Thanks.


Dynamic header

Posted: Thu Apr 18, 2013 6:55 pm
by Maryna Brodina

Hello! It's not possible to add label to header, but you can change any component using JS including header

codeTiggzi("mobileheaderName").text("new text")/code
mobileheaderName - header name


Dynamic header

Posted: Sat Apr 20, 2013 10:23 am
by Andrés Méndez

Hello.

I went to the page which header I want to change, selected it, and in Events I added:
Component: Page
Event: Load
Action: Run Javascript
Details: Tiggzi("mobileheaderName").text("new text");

But the page header doesn't change to "new text". What's wrong?

Also, I would like that the new header loads the name from a local text variable. How do I do that?

Thanks.


Dynamic header

Posted: Sat Apr 20, 2013 10:28 am
by Andrés Méndez

Ok, I've solved it.

My fault was that I didn't change the "mobileheaderName" to the name of my component, which was (by default) "mobileheader".

So the code now form me (which works) is:
Tiggzi("mobileheader").text("new text");


Dynamic header

Posted: Sat Apr 20, 2013 10:33 am
by Igor

Hello,

Is "mobileheaderName" the name of your header element?
Next tutorial will help you with local storage variables
http://docs.appery.io/tutorials/build...


Dynamic header

Posted: Sat Apr 20, 2013 10:42 am
by Andrés Méndez

Thanks Igor.

Using that tutorial, I've changed the Javascript into this (and works, I leave it here to help other people):
var titulo = localStorage.getItem("listaID");
Tiggzi("mobileheader").text(titulo);