[CLOSED] Detect when user resizes a treepanel

  1. #1

    [CLOSED] Detect when user resizes a treepanel

    I have a BorderLayout with a TreePanel in the West Region. I attached a listener to the TreePanel's bodyresize event. I want to catch when the user resizes the TreePanel using the splitter. When that happens, I send a quick AjaxMethod to update a setting in the database. However, I notice that the bodyresize event is fired 3-4 times when the page first loads and also fired when the browser size changes. Is there another event that tracks when the user initiates the resize?

    My current workaround is store the original width of the TreePanel and check during the event if the width changed before firing off the AjaxMethod. It works fine but just wondering if there's a better way.
  2. #2

    RE: [CLOSED] Detect when user resizes a treepanel

    Hi,

    What about to handle StateSave(make request to save required data)/StateRestore(make request to retrive required data) events. Also there is StateEvents property where you can define additional events which will be fire StateSave event.


    May be it is better to set Buffer="250" StateSave AjaxEvent
  3. #3

    RE: [CLOSED] Detect when user resizes a treepanel

    Thanks! StateSave is actually what I needed. Is there a point in using the ScriptManager's StateProvider? Instead of hooking on to the StateSave event for different controls, it would be awesome if there's a StateProvider that I can configure to hit an AjaxMethod or webservice to save the state of all controls.
  4. #4

    RE: [CLOSED] Detect when user resizes a treepanel

    Hi,

    At this moment ScriptManager's StateProvider is not working actually. I think we need review that property. You can make own provider (for example see HttpProvider - http://extjs.com/forum/showthread.php?t=24970) and add it as the following


    var p = new Ext.state.MyProvider({
    ...
    });
    Ext.state.Manager.setProvider(p);

  5. #5

    RE: [CLOSED] Detect when user resizes a treepanel

    Thanks. A followup question to your original solution. Is there a way to see what actually changed in the state object? For example, the state object contains the collapsed and width property. Usually, only 1 of those property is changing.
  6. #6

    RE: [CLOSED] Detect when user resizes a treepanel

    I don't think that it is possible because control call getState function when one of the state's events occur. Control can't distinguish what exactly was changed
  7. #7

    RE: [CLOSED] Detect when user resizes a treepanel

    No problem. I can keep track of it externally. As usual, thanks for the fast response!

Similar Threads

  1. [CLOSED] detect user scrolling till end
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 16, 2011, 5:34 PM
  2. [CLOSED] Treepanel in User Control
    By asztern in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 26, 2010, 7:36 PM
  3. Replies: 3
    Last Post: May 25, 2010, 4:29 PM
  4. [CLOSED] Menu resizes itself
    By gokcemutlu in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Aug 22, 2009, 4:44 AM
  5. [CLOSED] Detect if event was user initiated or code initiated
    By jchau in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 10, 2009, 4:23 PM

Posting Permissions