1. #1
    Ext User
    Join Date
    May 2009
    Posts
    6
    Vote Rating
    0
    StyleWarz is on a distinguished road

      0  

    Exclamation RESTful Store and some problems with it (dirty records, callback 'write' on Writer)

    RESTful Store and some problems with it (dirty records, callback 'write' on Writer)


    Hey there,

    i've been doing quite much with ExtJS 3 lately, but i've come across some questions regarding restful JsonStores.

    Code:
    Admin.Layouts.Store = new Ext.data.JsonStore({
        storeId: 'layoutsStore',
        url: '/api/layouts',
        autoLoad: true,
        root: 'results',
        totalRecords: 'resultCount',
        restful: true,
        fields: Admin.Layouts.Model,
        writer: new Ext.data.JsonWriter()
    });
    Problem 1:
    I am using this Store with an EditorGridPanel, whenever i edit a row and it get's saved onto the server (Server returns 200 OK) the record is marked as dirty in the grid.

    Problem 2:
    If i subscribe on('write', function(..) {..}), it gets never triggered. May this be because of restful? The downside of this is, that i've coded my API that it will return the whole record upon creation (including the auto-generated id), but ExtJS can't handle it.

    Help would really be appreciated!

    Thanks so far


    best regards

  2. #2
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    You didn't show your code for #2. #1 might be because you might have a phantom record. Check and see if you have an non-autogenerated id for the record that shows up dirty. Is it all fields that show dirty or select fields?

  3. #3
    Ext User
    Join Date
    May 2009
    Posts
    6
    Vote Rating
    0
    StyleWarz is on a distinguished road

      0  

    Default


    Just the changed fields show up dirty. And no, it also shows dirty if i do it on an entry where the id was autogenerated.

    Code for #2:
    Code:
    Admin.Layouts.Store.on('write', function(store, action, result, transactionres, rs) {
    	alert("written");
    });

  4. #4
    Ext User
    Join Date
    Feb 2009
    Posts
    16
    Vote Rating
    0
    fanzhongkai is on a distinguished road

      0  

    Default


    Sorry, I want to help you very much, but can you tell me what the dirty mean, when you use this word to describe a record or data. I'm from China ,sorry for my poor English...

  5. #5
    Ext User
    Join Date
    May 2009
    Posts
    6
    Vote Rating
    0
    StyleWarz is on a distinguished road

      0  

    Default


    It means that the field in your Grid has a red corner which shows that something went wrong while saving.

    Can you imagine?

  6. #6
    Ext User
    Join Date
    Feb 2009
    Posts
    16
    Vote Rating
    0
    fanzhongkai is on a distinguished road

      0  

    Default


    Ok, thx. You can use commitChanges method in store to remove the dirty mark, the dirty mark means that the store is not real saved!!!!!

  7. #7
    Ext User
    Join Date
    Feb 2009
    Posts
    16
    Vote Rating
    0
    fanzhongkai is on a distinguished road

      0  

    Default


    I've been puzzled for a long time ,what's the "dirty" mean. thanks you!!! HAHAHAHA
    好开心

  8. #8
    Ext User
    Join Date
    May 2009
    Posts
    6
    Vote Rating
    0
    StyleWarz is on a distinguished road

      0  

    Default


    Uhm the changes do get commited.. At least the JsonWriter sends the PUT and my API stores the changes..

    Still, any ideas why the write-Event doesn't work?

    Best regards

  9. #9
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    5
    mjlecomte will become famous soon enough mjlecomte will become famous soon enough

      0  

    Default


    Have you looked at the restful example? It shows the write event being triggered.

  10. #10
    Ext User
    Join Date
    May 2009
    Posts
    6
    Vote Rating
    0
    StyleWarz is on a distinguished road

      0  

    Default


    Yes, i've also tried it with the listeners config-param:

    Code:
    /**
     * Layouts Store
     */
    Admin.Layouts.Store = new Ext.data.JsonStore({
        storeId: 'layoutsStore',
        url: '/api/layouts',
        autoLoad: true,
        root: 'results',
        totalRecords: 'resultCount',
        restful: true,
        fields: Admin.Layouts.Model,
        writer: new Ext.data.JsonWriter(),
        autoSave: true,
        listeners: {
            write : function(store, action, result, res, rs) {
                alert(res.success + "=> " + res.message); // <-- show user-feedback for all write actions
            }
        }
    });
    This also doesn't work.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar