Results 1 to 4 of 4

Thread: Store.sync nulls non visible fields

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    59
    Answers
    6

    Default Answered: Store.sync nulls non visible fields

    Hellow world
    I have this kind of problem.
    I've defined a model:
    Code:
    Ext.define('ASV.model.docbody',{
        extend: 'Ext.data.Model',
        fields:[
            {name: 'docrejid',type:'int'},
            {name: 'docid',type:'int'},
            {name: 'article',type:'string'},
            {name: 'brand',type:'string'},
            {name: 'name', type:'string'},
            {name: 'quantity', type:'float'},
            {name: 'price', type:'float'}
        ]    
    });
    First 2 fields of this model are not supposed to be seen in a view. So I've defined view (gridPanel) columns like this:
    Code:
                columns:[
                    {header: 'article', dataIndex:'article',flex:1},
                    {header: 'brand', dataIndex:'brand', flex:1},
                    {header: 'name', dataIndex:'name', flex:2},
                    {
                        header: 'quantity', 
                        dataIndex:'quantity', 
                        flex:1,
                        field:{
                            xtype:'numberfield',
                            allowBlank:false,
                            minValue:0,
                            maxValue:10000
                        }
    
                    },
                    {
                        header: 'price', 
                        dataIndex:'price', 
                        flex:1,
                        field:{
                            xtype:'numberfield',
                            allowBlank:false,
                            minValue:0,
                            maxValue:10000
                        }
                    }
                ]
    Now after editing and syncing data to server those to hidden fields became equal to 0.
    Before Editing
    Code:
    {"body": [{"price": 119.0, "article": "24813", "brand": "FEBI BILSTEIN", "name": null, "quantity": 1.0}, {"price": 223.0, "article": "J1124031", "brand": "NIPPARTS", "name": null, "quantity": 1.0}, {"price": 153.0, "article": "5480XS", "brand": "GATES", "name": null, "quantity": 1.0}], "header": [{"docnumber": "ZK-1", "comment": null, "docid": 9, "summ": 495.0, "client": "\u041f\u0440\u043e\u0434\u0430\u043d \u041c.\u041c.", "date": "2011/12/26 11:14:55"}], "success": true}
    After editing:
    Code:
    [{"docrejid":0,"docid":0,"article":"24813","brand":"FEBI BILSTEIN","name":"","quantity":1,"price":121},{"docrejid":0,"docid":0,"article":"J1124031","brand":"NIPPARTS","name":"","quantity":1,"price":223},{"docrejid":0,"docid":0,"article":"5480XS","brand":"GATES","name":"","quantity":1,"price":153}]
    What am i doing wrong ?

  2. The store can have as many fields as you like and the grid may show none or all the fields. this shouldn't affect the values of the other fields of that record. I don't see any problem here. Could you post the code of your store, how you sync it and also the complete grid code. Is this "before" and "after" related to editing or syncing? The first two fields are not there in one of them! This would mean if you try to save it, those two values would be missing and might be set to 0 on the server side and may be that is why you have 0 values.

    Regards,
    Farish

  3. #2
    Sencha User
    Join Date
    Dec 2011
    Posts
    59
    Answers
    6

    Default

    Just tried to define all columns in gridPanel with those 2 columns property hidden:true, but no effect

  4. #3
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,102
    Answers
    113

    Default

    The store can have as many fields as you like and the grid may show none or all the fields. this shouldn't affect the values of the other fields of that record. I don't see any problem here. Could you post the code of your store, how you sync it and also the complete grid code. Is this "before" and "after" related to editing or syncing? The first two fields are not there in one of them! This would mean if you try to save it, those two values would be missing and might be set to 0 on the server side and may be that is why you have 0 values.

    Regards,
    Farish

  5. #4
    Sencha User
    Join Date
    Dec 2011
    Posts
    59
    Answers
    6

    Default

    Thanks for reply
    it was my mistake
    I've accidentally deleted those fields from initial response of the server
    Now its all ok

Posting Permissions

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