Results 1 to 4 of 4

Thread: BasicForm isDirty() works unexpected when using combo.setValue(XXX) after AJAX call

  1. #1
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    136

    Question BasicForm isDirty() works unexpected when using combo.setValue(XXX) after AJAX call

    I have a form with a bunch of fields and a combo box.

    When I initialize the form, I use setValue(xxx) in quite a few places. When I check formPanel.getForm().isDirty() - it works as expected (in a scenario where I submit the form).

    I added another element to my form (combo), that triggers an AJAX call, which, when it returns, does combo.setValue(xxx).

    It seems that this action marks my form as dirty, since after this, isDirty() always returns true.

    Please advise - I thought using setValue() sets a new "clean" state var for the field?

    Thanks!

    P.S.
    I saw in this thread:
    http://www.sencha.com/forum/showthre...asicForm.load()
    ...that setting
    trackResetOnLoad: true
    ...would fix this issue.

    However, my form is still marked dirty when my ajax method returns and does setValue() on the combo.

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

    Default

    trackResetOnLoad only affects setValues, not a single setValue.

    You can reset the dirty flag by using:
    Code:
    combo.originalValue = combo.getValue();

  3. #3
    Ext JS Premium Member
    Join Date
    Feb 2010
    Posts
    136

    Default

    Yay that did it!

    I didn't realize "Public Properties" like this one were meant to be interacted with, after the component is initialized. I'm assuming this is an isolated occurrence, where this works.

    Thank you!

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

    Default

    Good conclusion. Properties should be considered read-only and you should only modify them if you've looked at the code to see if it would actually work.

Similar Threads

  1. Replies: 2
    Last Post: 25 Oct 2010, 6:53 AM
  2. IsDirty & BasicForm.load()
    By TheNakedPirate in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 26 Jun 2009, 2:22 PM
  3. Replies: 5
    Last Post: 19 Mar 2009, 11:03 AM
  4. [SOVLED] Ajax Call only works one time
    By rufinus in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 18 Jan 2008, 8:50 AM

Posting Permissions

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