Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    26
    Vote Rating
    0
    dougi is on a distinguished road

      0  

    Default boolean field never set as modified when set with a boolean value

    boolean field never set as modified when set with a boolean value


    Hi,

    i use extjs 4.1 commercial

    i noticed something weird with boolean field.
    the field is set as modified when its value is set with a string and not a boolean value. quite unexpected.

    here is how it is declared:
    { name:'ready', type:'boolean', defaultValue: false, convert: null }

    and the behavior i notice.
    record.set('ready', true)
    record.isModified('ready') => false

    record.set('ready', 'true')
    record.isModified('ready') => true

    is that a bug or my mistake ?

    Thanks

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,785
    Vote Rating
    597
    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


    It depends, how is the record constructed?
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    26
    Vote Rating
    0
    dougi is on a distinguished road

      0  

    Default


    here is my model declaration:

    Code:
    Ext.define('QeApp.model.Version', {    extend: 'Ext.data.Model',
        
        fields: [
            { name:'id', type:'int' },
            { name:'type', type:'string' },
            { name:'ready', type:'boolean', defaultValue: false, convert: null } /* Boolean set as modified when set with string value only */
        ],
        associations: [...]
    });
    the ready field is also correctly set as boolean in the flow of data loaded from the server.

    Thanks again

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,785
    Vote Rating
    597
    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


    I can't reproduce it. I ran this against 4.1.0, it logs true for both records:

    Code:
    Ext.define('Foo', {
        extend: 'Ext.data.Model',
    
        fields: [{
            name: 'id',
            type: 'int'
        }, {
            name: 'type',
            type: 'string'
        }, {
            name: 'ready',
            type: 'boolean',
            defaultValue: false,
            convert: null
        }]
    });
    
    Ext.onReady(function(){
        var rec1 = new Foo({
            id: 1,
            type: 'type1',
            ready: false
        });
        rec1.set('ready', true);
        console.log(rec1.isModified('ready'));
        
        var rec2 = new Foo({
            id: 2,
            type: 'type2',
            ready: true
        });
        rec2.set('ready', false);
        console.log(rec2.isModified('ready'));
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Jan 2012
    Posts
    26
    Vote Rating
    0
    dougi is on a distinguished road

      0  

    Default


    ok, you are right, sorry for the post. I should have make this simple test myself. Thanks for the example. It still don't work in my case...i will find it

Thread Participants: 1

Tags for this Thread

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..."