Results 1 to 4 of 4

Thread: Asynchronous Event Listner for any beforeXXXXX event

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2013
    Posts
    43

    Default Asynchronous Event Listner for any beforeXXXXX event

    ExtJS provides many before events which are cancellable if the listener returns false.

    My question here is how to write an async event listener, like on closing Window/Tab show user a confirmation message dialog box.

  2. #2

  3. #3
    Sencha Premium Member
    Join Date
    Jul 2013
    Posts
    43

    Default

    @hakimio, Thanks for sharing the solution, the solution works well when having only one before event and having async listener for it.

    In our case user's action is triggering multiple events in the sequence, and success of first event will decide on triggering next events in the chain.

    For example:
    RowModel -
    1. beforedeselect
    2. deselect
    3. beforeselect
    4. select
    5. selectionchange

    The above mentioned events occurs in sequence when user tries to change selection in GridView/TreeView. In this scenario we would like to provide confirmation message to user when selection change occur. And based on user input selection should retain or change to the new selection.

    I can think of similar approach to be taken here as well by following steps:
    1. On "deselect" set the component property "old_selected".
    2. On "beforeselect" set the component property to "new_selected". and return false. Then show confirmation message.
    3. On Yes, select "new_selected"
    4. On No, select "old_selected"

    But again the question is when on No the "old_selected" gets selected it should not raise "selectionchange" event.

  4. #4
    Sencha User
    Join Date
    Apr 2013
    Posts
    913
    Answers
    105

    Default

    How about simply returning false from all of the "before" events and then simply manually selecting the record which user intended to select in the first place if he confirms the action? Then in case, he declines, you don't have to do anything. Everything stays the same.

Similar Threads

  1. listner for radio change event
    By webarnie in forum Ext Designer: Help & Discussion
    Replies: 2
    Last Post: 21 Feb 2011, 6:54 AM
  2. Event when a asynchronous treePanel is completely expand
    By Gordon25 in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 23 Aug 2010, 4:43 AM
  3. Is there a select Row Change event I could use in grid listner?
    By bryanevil in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 9 Jul 2010, 1:38 AM
  4. Replies: 7
    Last Post: 29 Apr 2010, 9:33 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •