1. #1
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68
    Answers
    1
    Vote Rating
    1
    pra123@ is on a distinguished road

      0  

    Default Unanswered: How to reset isDirty() for a controls

    Unanswered: How to reset isDirty() for a controls


    Hi,

    I am checking before closing the window isDirty() flag.
    When i will save this value to me DB, that time also its giving same values.

    So how i will reset this value after saving to database.
    So that after saving if i will modify anything then i will get to know.

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,913
    Answers
    371
    Vote Rating
    179
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68
    Answers
    1
    Vote Rating
    1
    pra123@ is on a distinguished road

      0  

    Default


    Hi,
    Thanks for your reply.

    still, i am not able to resolve my problem.
    it will help me if you provide an example about it.

  4. #4
    Sencha User
    Join Date
    May 2012
    Location
    Blumenau - Brazil
    Posts
    50
    Answers
    12
    Vote Rating
    8
    julio.batista will become famous soon enough

      0  

    Default


    If I unsderstood, it's
    Code:
    yourForm.getForm().reset();
    or
    Code:
    yourForm.getForm().reset(yourRecord);
    --
    Júlio César Batista - blog - twitter
    Web Developer

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68
    Answers
    1
    Vote Rating
    1
    pra123@ is on a distinguished road

      0  

    Default


    Actually me problem is like this.

    let's i have a text field control. If first time, i will check isDirty() status then i will get false.
    Now i will set some value to text field, if now i will check isDirty() status then i will get true.
    till now it's fine and no problem it is working for me.

    No i saved my text field value to some database.
    If now i will check isDirty() status then i should get false, but i am getting true.
    So i will achieve this or what i will do after saving for text field, so isDirty() status will reset..

    please help..

  6. #6
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,913
    Answers
    371
    Vote Rating
    179
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    The example at the top of the form panel's API doc shows a reset button at the bottom of the form.
    http://docs.sencha.com/extjs/4.2.1/#...Ext.form.Panel

    Here is the same example with a "check if dirty" button.
    Code:
    Ext.create('Ext.form.Panel', {
        title: 'Simple Form',
        bodyPadding: 5,
        width: 350,
    
    
        // The form will submit an AJAX request to this URL when submitted
        url: 'save-form.php',
    
    
        // Fields will be arranged vertically, stretched to full width
        layout: 'anchor',
        defaults: {
            anchor: '100%'
        },
    
    
        // The fields
        defaultType: 'textfield',
        items: [{
            fieldLabel: 'First Name',
            name: 'first',
            allowBlank: false
        },{
            fieldLabel: 'Last Name',
            name: 'last',
            allowBlank: false
        }],
    
    
        // Reset and Submit buttons
        buttons: [{
            text: 'Reset',
            handler: function() {
                this.up('form').getForm().reset();
            }
        }, {
            text: 'Check to see if Dirty',
            handler: function () {
                console.log(this.up('form').isDirty());
            }
        }, {
            text: 'Submit',
            formBind: true, //only enabled once the form is valid
            disabled: true,
            handler: function() {
                var form = this.up('form').getForm();
                if (form.isValid()) {
                    form.submit({
                        success: function(form, action) {
                           Ext.Msg.alert('Success', action.result.msg);
                        },
                        failure: function(form, action) {
                            Ext.Msg.alert('Failed', action.result.msg);
                        }
                    });
                }
            }
        }],
        renderTo: Ext.getBody()
    });
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  7. #7
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68
    Answers
    1
    Vote Rating
    1
    pra123@ is on a distinguished road

      0  

    Default


    Hello, thanks for the reply.

    When i am doing reset for 'form' then all the controls get cleared.
    and isDirty() working fine.

    But my problem, i don't want to clear all the field. it should show all the value whatever i have before saving.
    after saving isDirty() should give false.
    If again i will modify anything then it should give true.

    how i will reset isDirty() flag only, i do not want to clear all the field value.

  8. #8
    Sencha Premium Member
    Join Date
    Feb 2013
    Location
    Bangalore, India
    Posts
    68
    Answers
    1
    Vote Rating
    1
    pra123@ is on a distinguished road

      0  

    Default


    Whether sencha provide any method for 'form' to call "resetOriginalValue()" for all the controls of form.

    i mean is there any way or method to get all the controls item id to call "resetOriginalValue()" method.
    or any method which will call "resetOriginalValue()" method for all the controls.

  9. #9
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,913
    Answers
    371
    Vote Rating
    179
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    You might look at loading the form with a record using loadRecord. When you reset() a form that was loaded with a record you can choose whether to reset completely or just back to the values loaded from the record.

    When changes occur in the form you can use updateRecord. And instead of using the form's submit action you can give the record a proxy and use the record's save() method to save values back to the server.
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi