Re: History tokens and vertical menu panel
Anything before the hash "#" needs to be identical from place to
place otherwise you'll be loading the page from the web server and
losing state. There are ways to get around this (i.e. servlet
session state , cookies, preservation of state as url params...)
however if your intention is to not go back to the web server for a
new page then you'll have to make sure your that your url is the same
before the hash.
In addition, using "a href=" will still cause page reloading on some
versions of internet explorer
Try using
1) A Gwt Anchor with your own event handler to inovke "
History.newItem(token );"
2) InlineHyperlink with targetHistoryToken="token value"
Hope this helps,
David
On Dec 6, 3:38 pm, JavaCool4Me <sascha.monte...@gmail.com> wrote:
> the onValueChange is my menu handler which works fine for the links in
> the menu panel
>
> On page1 I have a celltable with links to page2, if I click on a link
> (<a href='?dep=Sales#page2'>Sales</a>)
> it does go to page2, but the page fully reloads and the Vertical Menu
> Panel is in initial state, not on the 2nd group
>
> When looking for examples I saw that I had to put ?dep=Sales before
> the history token, is that not correct?
> Should I have <a href='#page2?dep=Sales'>Sales</a> instead? Or will
> that break access from IE browsers?
>
> On Dec 7, 1:03 am, David <levy...@gmail.com> wrote:
>
> > "I also pass a parameter in the string with href='?dep=blah#page2') "
> > if any portion of the url prior to the # changes then app will reload
> > (come through onModuleLoad() again.
>
> > I'm not sure if that is what you are doing as I don't see the menu
> > event handling in your sample
>
> > On Dec 5, 8:06 pm, JavaCool4Me <sascha.monte...@gmail.com> wrote:
>
> > > Hi,
> > > I am building a new application with a vertical panel menu, which
> > > works fine,
> > > but within some pages I have links to other pages ( which is a history
> > > token),
> > > but I need the vertical panel to slide to the correct group.
> > > The links in the page work fine now, but the panel does not slide.
> > > When I click a link from i.e. page1 to page2, the whole page reloads,
> > > but the content is correct
> > > (I also pass a parameter in the string with href='?dep=blah#page2')
>
> > > I am not sure about the usage of History and fireCurrentHistory, but
> > > without that the inter page links don't seem to work
>
> > > --
> > > public class GwtTest implements EntryPoint, ValueChangeHandler<String>
> > > {
> > > MenuBuilder mb;
> > > public void onModuleLoad() {
> > > mb = new MenuBuilder();
> > > mb.buildMenuFromXml("Test");
> > > hp = new HTMLPanel("<div id='printWidget'></div><div
> > > id='dateWidget'></div><div id='reportWidget'></div>");
> > > RootPanel.get("appPanel").add(hp);
> > > DoHomePage.render(hp);
> > > History.addValueChangeHandler(this);
> > > if(History.getToken().isEmpty()) {
> > > History.newItem("home");
>
> > > }
> > > History.fireCurrentHistoryState();
> > > mb.setMenuPanelActive(History.getToken());
> > > }
>
> > > public void onValueChange(ValueChangeEvent event) {
> > > if(History.getToken().equals("home")) {
> > > hp.clear();
> > > DoHomePage.render(hp);
> > > mb.setMenuPanelActive(History.getToken());
> > > }else if(History.getToken().equals("page1")) {
> > > hp.clear();
> > > DoPage1.render(hp);
> > > mb.setMenuPanelActive(History.getToken());
> > > }else if(History.getToken().equals("page2")) {
> > > hp.clear();
> > > DoPage2.render(hp);
> > > mb.setMenuPanelActive(History.getToken());
> > > }
>
> > > }
>
> > > }
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home