1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    12
    Vote Rating
    0
    dee_rocks is on a distinguished road

      0  

    Default How can I cancel an event?

    How can I cancel an event?


    Hi,

    I an using the "rowdeselect" for saving the row data when the user tabs off to a new row in the GRID. I want to add some validation to check if the certain fields are populated before the row is sent to the database.

    Let's say if a user clicks the ADD btn and tabs off the record in which case the rowRecord.dirty will be false ( where var rowRecord = sm.getSelected()

    I want to show an alert statement and force the user to go back to the row where they left the mandatory fields empty.

    How can I ;

    1) reject the rowdeselect event that was fired?
    2) Is there a better way of doing this?

    Thx.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    17,004
    Vote Rating
    650
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Usually, the convention is you either:

    a) Return false in the handler
    Code:
    Ext.get('a').on('click', function(e)
    {
       return false;
    }
    );
    b) Set e.cancel to true
    Code:
    Ext.get('a').on('click', function(e)
    {
       e.cancel = true;
    }
    );

Thread Participants: 1