PDA

View Full Version : [SOLVED] Problem refreshing the GridPanel



talha06
30 Nov 2009, 2:38 PM
Hello to everyone,

I'm not an advanced developer at ExtJS. I'm working a library automation system. In my search page when the page opened first time, I show ALL books on grid.. After the user enters the keywords for search I want to refresh the grid.. When user enters keywords and click the button, I connect with DB and return the records.. I change the store's proxy url.. There's no problem at these steps.. Because I checked the returning values(actually they're books in my project).. I can't refresh the grid.. I see ALL records(as I see first).. Nothing changes..

Here's what I tried.. Actually I searched a lot and saw that many people have same problem.. I did what they recommend, but their recommendations didn't work for me..

Thanx in advance,
T

Here's the code:

handler: function() {
var m = Ext.getCmp('searchText').getValue();
var n = Ext.getCmp('byText').getValue();
Ext.Ajax.request({
url: 'searchList?searchText='+ m +'&byText=' + n,
method: 'POST',
success: function(result, request) {
// new store proxy url - this one returns the searched books; first one lists ALL books
Ext.getCmp('grid').getStore().proxy.conn.url = 'searchList?searchText='+ m +'&byText=' + n;
Ext.getCmp('grid').getStore().reload();
}
})
}

// I tried these too (which I saw from the forum(s))
//Ext.getCmp('grid').getStore().load({url:'searchList?searchText='+ m +'&byText=' + n});
//Ext.getCmp('grid').getStore().reload({url:'searchList?searchText='+ m +'&byText=' + n});
//Ext.getCmp('grid').getView().refresh(true);

talha06
30 Nov 2009, 4:15 PM
I need an instant help... please can someone help me?? :-/

LutzAlbers
1 Dec 2009, 4:52 AM
Why do you hard code the URL parameters manually by modifying the URL ?
Use the params: config parameter of the store and load the store with them.


Ext.getCmp('grid').getStore().load({ params: {searchText: m, byText:n } });

That should reload the grid.

talha06
1 Dec 2009, 9:31 AM
thank u so much dear LutzAlbers, it worked finally.. really it appreciated a lot, thanx a lot again for taking time to reply and help.. :)