1. #1
    Ext User
    Join Date
    Mar 2010
    Posts
    31
    Vote Rating
    0
    ykoehler is on a distinguished road

      0  

    Default Using URL's hash and history

    Using URL's hash and history


    I am trying to build a big application that will require URL to be working even if the application is totally driven by AJAX. I am using the hash part of the URL to indicate when the location change and using Ext.History I can be notified properly when the back/forward buttons of the browser is used.

    This is all fine, yet, my issue is about the first load. What method must I used to initialize a tab, tree or grid panel to properly select the choice indicated inside the hash string?

    It seems that Ext.History change event only fired up when it change after the initial load, and it seems that each panels (tree, tab, grid) have their own method to handle selection which is kind of a pain, and even tree have 2, if you load the nodes statically the TreeLoader load event isn't fired but if you do it using a remote AJAX to load the nodes then they event is fired.

    Is there a recommended method to have the different panels set their initial state based on the actual history when the first load is executed? What does expert in ext js recommend?

    My current method is that I subclass the tab panel for example and listen for history change, and on the initial load I retrieve the id/value pair from the current location to set the initialTab. For a tree, I register on both the history change and the loader load and this works fine for asynch loaded tree but not static one (where all the node are in the js code).

    And I need a solution to grid as well.

    --
    Yannick Koehler

  2. #2
    Ext User
    Join Date
    Mar 2010
    Posts
    31
    Vote Rating
    0
    ykoehler is on a distinguished road

      0  

    Default


    Here is an example of my hash string:

    firstTabId:TabName,FirstNavTree:/rootNodeId/OtherNodeId/SelectedNodeId,SecondNavTree:/rootNodeId/OtherNodeId/SelectedNodeId

    Each panel that can record their location in the hash will search for their id in the hash string and attempt to select their content initially based on the value found for their ids.

    When the selected entries of such a panel is changed, they rebuild the hash string and call Ext.History.add() with it and this alter the hash url part.

    The application itself is not aware of which UI panel require location information, this allow for easily adding / removing / editing navigation items in a page without having to change a central location all the time.

  3. #3
    Ext User
    Join Date
    Mar 2010
    Posts
    31
    Vote Rating
    0
    ykoehler is on a distinguished road

      0  

    Default


    I also want to note that while I know Ext JS has states and the like the problem here is that the "location" isn't a state. The fact that some of the node are expanded or collapsed, that to me is a state, but which one is actually selected that is a location.

    I do use state but those stays in a cookies, they indicate non location information.

  4. #4
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    45
    Vote Rating
    0
    digvijayun is on a distinguished road

      0  

    Default I am also having the same problem.

    I am also having the same problem.


    Hi Yannick,
    Did you find any solution to your problem while loading it for the first time?

    Regards,
    Jay

Similar Threads

  1. Ext.history "How to hide Appended url via ext.history"
    By ahmadfareed in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 10 Feb 2010, 10:14 PM
  2. Replies: 0
    Last Post: 11 Feb 2009, 9:57 PM
  3. History and url
    By randomuser01 in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 22 Oct 2008, 12:13 PM
  4. Help - IE6: pasting a URL breaks history
    By DTT_11-1983 in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 19 Sep 2008, 2:44 AM
  5. Using a hash in a grid?
    By maccman in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 24 Apr 2007, 8:36 AM

Thread Participants: 1