Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.86 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ExtJS4 Changing data store parameters
  2. store = Ext.create('Ext.data.Store', {
  3.     fields: [
  4.        {name: 'id'},
  5.        {name: 'filename'},
  6.        // other fields here ...
  7.     ],
  8.     proxy: {
  9.         type: 'ajax',
  10.         url : 'http://myniftyurl.com/blah',
  11.         simpleSortMode : true,
  12.         reader: {
  13.             type: 'json',
  14.             totalProperty: 'total',
  15.             root: 'result'
  16.         },
  17.         extraParams : {
  18.             'limit' : Ext.get('itemsPerPage').getValue(),
  19.             'to' : Ext.get('to_date').getValue(),
  20.             //  other params
  21.  
  22.         }
  23.     },
  24.         model: 'Page',
  25.         remoteFilter : true,
  26.         remoteSort : true,
  27.     });
  28.        
  29. //getForm() retrieves the Ext.basic.Form (from Ext.panel.Form)
  30. var params = this.getForm().getValues();
  31.  
  32. //Write over
  33. grid.getStore().getProxy().extraParams = params;
  34.  
  35. //load
  36. grid.getStore().load();