1. #1
    Sencha User
    Join Date
    Feb 2011
    Posts
    2
    Vote Rating
    0
    abdullahs is on a distinguished road

      0  

    Question Dynamic Event Handlers

    Dynamic Event Handlers


    Hi All,

    I am working on creating dynamic UI, just wanted to know if GXT provides or if there is a way to have dynamic event handlers.

    For eg., on the screen there is a form with some fields and just below the form there is a grid which makes an rpc call and displays the data from the db table which is being populated by the form.

    Now if there user fills and submits the form, the grid should know that it has to fetch the data again so as to display the new record.

    This can been easily done, by making an rpc call just after submitting the form, but as the UI is being created dynamically the widgets are not aware of each other.

    So I want to have a event, say "reloadCustomers" which will be fired by the form when done with submitting the data, and the grid to handle this event and reload itself.

    Any ideas / suggestions on how to implement this or links will be helpful.


    Thanks,
    Abdullah

  2. #2
    Sencha User
    Join Date
    Nov 2008
    Location
    Vienna - Austria
    Posts
    867
    Vote Rating
    1
    micgala is on a distinguished road

      0  

    Default


    Why don't you do exactly what you suggested?
    Create a new listener... say ReloadCustomersListener.

    Then make the class having your grid be a listener (or create a listener inside it).
    When receiving the event, then simply reload the grid....

    I don't see the point here...

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Posts
    2
    Vote Rating
    0
    abdullahs is on a distinguished road

      0  

    Question


    No, the listeners too has to be dynamic .. so what I meant is .. the pseudo code will be something like

    EventBus ev = EventBus();

    then the grid will add itself to listed for reloadCustomers event

    GridPanel gp = new GridPanel();
    ev.addEventHandler("reloadCustomers", gp);

    so the form after submitting the data will say ev.fireEvent("reloadCustomers");

    So basically the listeners, handlers & eventbus all has to be dynamic

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Nov 2010
    Posts
    209
    Vote Rating
    -2
    Ersmarker has a little shameless behaviour in the past

      0  

    Default


    You should not use string as type for events, since it's not typesafe.
    Instead create a new event type like this.

    Code:
    public class MyEvents extends Events {
       public static final EventType ReloadCustomers = new EventType();
    }
    
    
    fireEvent(MyEvents.ReloadCustomers,event);

Similar Threads

  1. Event handlers
    By eoriodan in forum Sencha Touch 1.x: Discussion
    Replies: 6
    Last Post: 9 Sep 2010, 4:02 PM
  2. Help with event handlers in Grid
    By Zoze in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 11 Feb 2009, 4:19 AM
  3. Field event handlers (need help)
    By end-user in forum Ext 1.x: Help & Discussion
    Replies: 6
    Last Post: 24 Aug 2007, 7:14 AM
  4. Removing event handlers
    By incunix in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 4 Jul 2007, 2:43 AM

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar