Dienstag, 20. Dezember 2011

Sencha Touch 1.1 - CRUD actions & callbacks via REST proxy

CRUD actions
Methods without value param (update, destroy):
store.update({
    callback: function(answer, object, success) {
        if (success) { ... }
    }
});

store.destroy({
    callback: function(answer, object, success) {
        if (success) { ... }
    }
});


Methods with value param (create, load):
store.create(values, {
    callback: function(answer, object, success) {
        if (success) { ... }
    }
});

store.load({
    callback: function(answer, object, success) {
        if (success) { ... }
    }
});


CRUD action executes only once?
If you can run some of these functions once and after that no XHR is made, it may be because you encountered this bug: Bug @ Sencha Forum

I solved this bug by setting store.snapshot to false, so the function that engages the XHR is no longer looking for changes in the snapshot but in the store object.

Keine Kommentare:

Kommentar posten