FraserHardy_uk
Posts: 0
Joined: Thu Jan 26, 2012 10:32 am

How to change header text programmatically (or link to a REST output)?

Is it possible to change the text of the page headers programmatically? Or have them linked to a service output?

Thanks,

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to change header text programmatically (or link to a REST output)?

Here is how to do it programmatically:

code
($('h1').first().text('New header'));
/code

As for mapping, not yet possible.

Stichoza
Posts: 0
Joined: Mon Apr 23, 2012 11:49 pm

How to change header text programmatically (or link to a REST output)?

How to change text of other page header?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to change header text programmatically (or link to a REST output)?

What do you mean by "other page header"? What is other?

Claudio
Posts: 0
Joined: Thu May 31, 2012 9:29 pm

How to change header text programmatically (or link to a REST output)?

Hi,
if you use navigateTo("second_page","ajax"), and want change the second page's header, the first h1 tag is not the right one.

I use ($('h1[dsid="header_name"]').first().text("new text")) instead.

Brian Wente
Posts: 0
Joined: Thu Mar 28, 2013 3:00 am

How to change header text programmatically (or link to a REST output)?

So I can use this?

($('h1').first().text(categoryName));

On the previous page, I need to set the value of categoryName and store it as a local storage variable.

Then "on load" run the javascript?

Brian Wente
Posts: 0
Joined: Thu Mar 28, 2013 3:00 am

How to change header text programmatically (or link to a REST output)?

how does the categoryName or the local storage value get read by the javascript variable?

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to change header text programmatically (or link to a REST output)?

To read from local storage:
localStorage.getItem('key');

Brian Wente
Posts: 0
Joined: Thu Mar 28, 2013 3:00 am

How to change header text programmatically (or link to a REST output)?

Perfect!

($('h1').first().text(localStorage.getItem('categoryName')));

Thanks!

Return to “Issues”