Search code examples
javascriptextjsextjs4extjs4.2

How to aggregate store calls


I need to call one store two times with different parameter values. Is there any way to aggregate two different calls?

var result1 = myStore.load({params:{id:id1}}); ==> 3 results
var result2 = myStore.load({params:{id:id2}}); ==> 4 results
                                                   Total 7 results

Solution

  • Use the addRecords: true config option to your second and subsequent load params if you want to aggregate the records.

    See: http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store-method-load

    But if you want to send both loading sequences as one request, you will have to modify your server's API to accept multiple IDs.