Sticky Notes

Montag, 3. März 2014
Sencha Store to JSON data
var dummyStore = Ext.getStore('dummyStore');
// This will serialize your data to json
var jsonData = Ext.encode(Ext.Array.pluck(dummyStore.data.items, 'data'));

Sencha Store callback when finished loading
var dummyStore = Ext.getStore('dummyStore');
dummyStore.load({
    callback: function (r, options, success) {
        if (success === true) {
            // HANDLE SUCCESS HERE
        }
    }
});

Sencha Touch filter store
Filtered items will not be counted if you use the store.getCount() method.

var dummyStore = Ext.getStore('dummyStore');
dummyStore.clearFilter();
dummyStore.filter([{
   property: 'state',
   value: 'confirmed'
}]);
dummyStore.load();

As you can see the filter is an array, you can easily add more than one filter property:
[
    {
       property: 'prop1',
       value: 'confirmed'
    },
    {
       property: 'prop2',
       value: 'accepted'
    },
]

Sencha Touch Ajax request
   Ext.Ajax.request({

     url: '', // Place the url here

     method: 'POST', // Methods: POST or GET

     params: {}, // All Parameters will be attached to the request URL ?para1=abc&para2=123

     headers: {}, // Place all your headers you want to send here

     success: function (response) {}, // This function will be called if your request is successful

     failure: function (response) {} // This function will be called if your request is NOT successful
 });

For more options checkout the Sencha Docs: LINK

Sencha Touch JsonP request
Ext.data.JsonP.request({
    url: '', // Place the url here

    method: 'GET', // JsonP does only support the GET Method, this is optional it will use GET anyway

    params: {}, // All Parameters will be attached to the request URL ?para1=abc&para2=123

    timeout: 600000, // Timeout until the request fails

    disableCaching: false, // Automatically add ad _dc Parameter to the reuqest URL

    success: function (response) {}, // This function will be called if your request is successful

    failure: function (response) {} // This function will be called if your request is NOT successful
});

For more options checkout the Sencha Docs: LINK