1. #1
    Ext User
    Join Date
    Nov 2008
    Posts
    10
    Vote Rating
    0
    rosemondi is on a distinguished road

      0  

    Default form isDirty() always return true, when using itemselector and loading data for it...

    form isDirty() always return true, when using itemselector and loading data for it...


    I meet an issue about isDirty() and ItemSelector.

    There is an itemselector in a form and the data is dynamically loaded to the form fields by ajax (the selected and from store of itemselector will be changed based on loading data). Although'trackResetOnload" is set to true, form.isDirty() always returns true.

    Is there something like originalValue of itemselector? If so, after loading, i can manually reset its original value. Or are there any other smart methods to handle it?

    Thx

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    9
    Vote Rating
    0
    rborg is on a distinguished road

      0  

    Default For anyone else still experiencing this issue

    For anyone else still experiencing this issue


    here is a fix, combined with a fix provided by tungj (OPEN-1200] Ext.ux.form.ItemSelector leak due to ItemSelector.js line 93/117) that solves both problems for the itemSelector


    Code:
    var origRender = Ext.ux.form.ItemSelector.prototype.onRender;
    var origBeforeDestroy = Ext.ux.form.ItemSelector.prototype.beforeDestroy;
    Ext.override(Ext.ux.form.ItemSelector, {
        beforeDestroy: function(){
            origBeforeDestroy.apply(this, arguments);
            if (this.rendered) {
                // Need to deregister the click listeners otherwise the selector and children will leak
                this.toTopIcon.un('click', this.toTop, this);
                this.upIcon.un('click', this.up, this);
                this.downIcon.un('click', this.down, this);
                this.toBottomIcon.un('click', this.toBottom, this);
                this.addIcon.un('click', this.fromTo, this);
                this.removeIcon.un('click', this.toFrom, this);
            }
        },
        onRender: function() {
            origRender.apply(this, arguments);
            // Want to destroy the panel containing the multiSelects, but it's internal
            // so have to access it via ownerCt
            var leakPanel = this.toMultiselect.ownerCt;
            this.on('destroy', leakPanel.destroy, leakPanel);
        },
        afterRender: function(){
            Ext.ux.form.ItemSelector.superclass.afterRender.call(this);
    
            this.toStore = this.toMultiselect.store;
            this.toStore.on('add', this.valueChanged, this);
            this.toStore.on('remove', this.valueChanged, this);
            
            //change for a custiom load not value changed as in original code
            this.toStore.on('load', this.valueLoad, this);
            this.valueLoad(this.toStore);
        },
        valueLoad: function(store) {
            var record = null;
            var values = [];
            for (var i=0; i<store.getCount(); i++) {
                record = store.getAt(i);
                values.push(record.get(this.toMultiselect.valueField));
            }
            var valuesToSet = values.join(this.delimiter);
            this.hiddenField.dom.value = valuesToSet;
            this.originalValue = valuesToSet;
        }
    
    
    });

Thread Participants: 1

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