• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

[SOLVED] Grid store reload

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED] Grid store reload

    Ok, this MVC is hurting my head. I have a grid, with an associated store. I have search fields, that should make the store reload the data and update the grid. I have a listener set up in my controller:
    Code:
    '#searchpo': {
    				specialkey: function(field, e) {
    					if (e.getKey() === e.ENTER) {
    						var searchPOValue = this.getPurchaseOrderGrid().down("#searchpo").getValue();
    						var theGrid = this.getPurchaseOrderGrid();
    						var theGridStore = theGrid.getStore();
    						theGridStore.removeAll();
    						theGridStore.proxy.extraParams = {searchpo: searchPOValue};
    						theGridStore.load();
    						Ext.Msg.alert('Sweet!', 'You searched for PO ' + searchPOValue);
    					}
    				}
    			}
    I get a 500 server error on the load().

    I can provide more info if needed.
    Last edited by barnettc2; 04-30-2012, 08:20 AM. Reason: Solved

  • #2
    This should work for you...
    Code:
    var searchPOValue = this.getPurchaseOrderGrid().down("#searchpo").getValue();
    var theGrid = this.getPurchaseOrderGrid();
    var theGridStore = theGrid.getStore();
     //theGridStore.removeAll(); // no need to removeAll
     //theGridStore.proxy.extraParams = {searchpo: searchPOValue}; // this was changing the entire extraParams object
    theGridStore.proxy.extraParams.searchpo = searchPOValue;   // adding a new property "searchpo" to the extraParams object
    theGridStore.load();
    Ext.Msg.alert('Sweet!', 'You searched for PO ' + searchPOValue);

    Comment


    • #3
      Wow. That makes more sense than I thought it would. Thanks.

      Comment

      Working...
      X