Results 1 to 6 of 6

Thread: Validation in EditorGridPanel

  1. #1
    Sencha User
    Join Date
    Oct 2009
    Posts
    66

    Default Validation in EditorGridPanel

    Hello,
    In EditorGridPanel has 2 columns are TextFeild editable.
    I also implemented validateedit event for cell validation.

    Here is the scenario.
    When i edit the cell in first column (assume i entered wrong value and validation fails)
    and tabout, validateedit event calls and it returns false.

    What is happening is while tabbingout the cursor focuses to the next editable column and starts editing.

    I want to change this behaviour. If validation fails i want to focus in the same cell and not to focus on the next editable cell.

    Thanks in advance for the reply.

  2. #2
    Sencha User
    Join Date
    Oct 2009
    Posts
    66

    Default

    Any comments on this question?

  3. #3
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    Wouldn't that be extremely annoying for users that enter an invalid value and can't exit the cell editor (e.g. to cancel the window) until they enter a valid value again?

    I once write a plugin that would mark any invalid values in the grid (the same as invalid fields in a form). However, I don't know if that still works on the current Ext version...

  4. #4
    Sencha User
    Join Date
    Oct 2009
    Posts
    66

    Default

    Thanks, for the response Condor. You are right it didn't make sense. But the requirement was like that.

    For the solution, i was trying to Override CellSelectionModel (fn handleKeyDown ) the place where to navigate away from that cell. But didn't successed 100%

  5. #5
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    Can you not just write a beforeedit handler for the second cell and then check if the first has been modified and is "valid" before allowing the handler to continue?

  6. #6
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    Quote Originally Posted by fay View Post
    Can you not just write a beforeedit handler for the second cell and then check if the first has been modified and is "valid" before allowing the handler to continue?
    No, you can't because by the time the beforeedit event is fired the original editor has already reverted to it's previous valid value.

    This is rather complicated to do. All occurrences of a startEditing call (without a true parameter) will first need to check if the current editor is valid.
    And no, overriding startEditing doesn't work, because the calling methods need to stop their processing if the current editor isn't valid.

Posting Permissions

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