Results 1 to 7 of 7

Thread: Syncing propertyGrid does send modified record

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

    Default Answered: Syncing propertyGrid does send modified record

    Hello.
    Here is my problem:
    I have a store (linked with propertyGrid with data:
    Code:
    [
    {name:"name1",value:'value1'},
    {name:"name2",value:'value2'},
    {name:"name3",value:'value3'},
    {name:"name4",value:'value4'},
    ]
    - when I change for example property name2 and then sync the store, firebug shows that all the records are sent except the modified record
    - when i change property name2 - sync acts the same way
    - when I set the store property autoSync to true all works correctly. But I don't need autoSync I need manual sync

    Is it a bug or I'm doin some think wrong

  2. A small workaround:
    When I edit record it propertyGrid, it sets model proerpty pantom to false.
    that when invoking sync method it filters records and records with phantom == false are filtered out.
    toUpdate - is empty and that is why the modified records are not sent to the server
    a small workaround is to add listener to update event with such code:
    Code:
            store.on('update',
                function(store,record,operation){
                    record.phantom = true;
            });
    this forcibly sets phantom property to record and it will be sent to server in toCreate packet

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449
    Answers
    3997

    Default

    If you only changed one then it should only send one when you sync()
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

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

    Default

    Yes I know that but it does just the opposite, it sends ALL BUT CHANGED

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

    Default

    This is real example
    server data:
    Code:
    {"header": [{"name": "docnumber", "value": "ZP-10"}, {"name": "comment", "value": "\u043a\u0443\u043a\u0443\u043a\u0443\u043a\u043a"}, {"name": "docid", "value": 59}, {"name": "summ", "value": 55732.0}, {"name": "client", "value": "ip-auto"}, {"name": "status", "value": "\u041e\u0442\u0440\u0438\u043c\u0430\u043d\u043e"}, {"name": "date", "value": "2011/12/31 22:01:29"}], "success": true}
    changed data posted to server (changed comment field and as you can see there is no "comment" field):
    Code:
    [{"name":"client","value":"ip-auto"},{"name":"date","value":"2011/12/31 22:01:29"},{"name":"docid","value":59},{"name":"docnumber","value":"ZP-10"},{"name":"status","value":"\u041e\u0442\u0440\u0438\u043c\u0430\u043d\u043e"},{"name":"summ","value":55732}]

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

    Default

    I've made some investigations and here are the results:
    1.When I change value of the "comment" field and that trigger sync method it invokes these commands:
    Code:
    toCreate  = me.getNewRecords(),             toUpdate  = me.getUpdatedRecords(), 
    
                toDestroy = me.getRemovedRecords(),
    toCreate - is filled with 6 values that was not modified
    toUpdate - is filled with 0 (ZERO!!!) values
    toDestroy - 0 values

    May be some people here can explain why is it so? I think that when I change the value of one record it should be some thing like this:
    - toCreate = 0
    - toUpdate = 1
    - toDestroy = 0

    Am I wrong ?

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

    Default

    A small workaround:
    When I edit record it propertyGrid, it sets model proerpty pantom to false.
    that when invoking sync method it filters records and records with phantom == false are filtered out.
    toUpdate - is empty and that is why the modified records are not sent to the server
    a small workaround is to add listener to update event with such code:
    Code:
            store.on('update',
                function(store,record,operation){
                    record.phantom = true;
            });
    this forcibly sets phantom property to record and it will be sent to server in toCreate packet

  8. #7
    Sencha Premium User
    Join Date
    May 2009
    Posts
    158
    Answers
    2

    Default

    I have a very similar problem with propertyGrid: I configure a store record (different store) as the grids source. The grid is nested in a window, so if I close this window (= neglecting changes to my record), I want my record to be unmodified - even I made changes in the grid.

    Currently the grids update behavior is to set all modified values in my record (grid source), so the changes live on in my record after closing the grid (= unwanted behaviour). Therefore I would like to reject changes made to record on grid closing. Unfortunately the grid never marks values as modified after editing, thus calling record.reject() doesn't work! This might be a bug in ExtJS 4.07...do you have any other/better idea how I could reject changes to my record?

Posting Permissions

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