0
votes

In EXTJS 4.2 , for Ext.data.reader.Reader there is messageProperty, successProperty, totalProperty configuration to set.

My question is if I don't set these config in reader then also i can fetch the same in my store load event (I i have send something from server).

EXT JS Code:

Ext.create('Ext.data.Store', {
    proxy: {
        type: 'ajax',
        url: '...',
        reader: {
            type: 'json',
            root: 'data',
        },

PHP server response

array('message' => 'No data found');

on EXT JS

store.load: function(store, records, options){

               console.log(store.getProxy().getReader().rawData);
            },

Then what is use of messageProperty, successProperty, totalProperty configuration, If without setting them also I can fetch server data. May be I am not aware of how to use it ...please guide me

2

2 Answers

1
votes

messsageProperty , successProperty , totalProperty are for different purpose. If you specify them, you can access them like getMessage, getSuccess, getTotal from reader

1
votes

Well you are getting it wrong. Basically purpose/use of those properties is :

1) totalProperty : When you apply paging, this property will come into the scenario. Total number of records available will be specified using this property. Consider the example, there are 100 accounts, and you are showing them 10 at a time in a grid. And your response is like {totalAccounts: 100, data : {account1, account2, ..., account10}}. Here, paging will create 10 pages using number_of_pages=totalAccounts/10. Here, in reader, at the time of configuring reader, you will specify this property like:

reader: {           
    root: 'data',
    type: 'json',
    totalProperty: 'totalAccounts'
}

2) successProperty: Sometimes, you may want to know whether your request is successful or failed? In this case, this parameter can be customized. You can set success parameter what server is returning. For e.g. I use requestStatus as successProperty as server returns whether current request is processed successfully or it has errors.

3) messageProperty: similar to successProperty, but here you can use messages from server side directly.