PDA

View Full Version : How you pass the store with a param to the GRID(parameter should not be hardcoded) ?



kaolin1k
23 Dec 2011, 2:42 AM
Hello,

I implemented my grid using componnet pagingtoolbar (Ext.toolbar.Paging) in ExtJs 4, when I load the grid
use some params(not harcoded), so the problem appear when you try the refresh button from the grid,
I can't rewritte this button.
Do you have some idea in this direction ?
How you pass the store with a parameter to the GRID
(the parameter should not be hardcoded in the store definition) ?
Thank you in advance !

Regards,
kaolin1k.





gridStore : function() {
return Ext.getStore('test.TestStore');
},


title: 'Test title',


gridColumns : function() {
return [{
header: 'Id Test',
dataIndex: 'id',
flex : 0.25
}, {
header: 'Value Test',
dataIndex: 'value'
flex : 0.25
}]
},


doRefresh: function() {
this.gridStore().load({
params: {
id: root.getIdTest()
}
});
}

skirtle
23 Dec 2011, 2:47 AM
Either add it to the extraParams on the proxy or add a beforeload listener to the store and add it in just before each request.

Contrary to what the docs suggest, extraParams can be changed whenever you like, not just at creation time. Something like:


store.getProxy().extraParams.id = root.getIdTest();
store.load();

ashish.1983.agrawal
18 May 2014, 4:51 AM
I have two grids getting data from php mysql backend First grid is display of all classes in a school. This represents 1 table of mysql. And I have no issues in displaying data second grid gets data of students in a particular class, when one clicks on any of the class of first grid. Please see image below
http://i.stack.imgur.com/ptd1m.png
This is a different table in mysql. And I am "ClassID" to php file. which sends sorted JSON of students of that particular class
i use the below code
var studentView = this.getstudentGrid; var ClassData = record.get('ClassID');

studentView.getStore().load({ params:{ClassID: ClassData} });but it says uncaught error and nothing gets displayed. Kindly help

javascript (http://stackoverflow.com/questions/tagged/javascript) php (http://stackoverflow.com/questions/tagged/php) mysql (http://stackoverflow.com/questions/tagged/mysql) extjs (http://stackoverflow.com/questions/tagged/extjs) sencha-architect (http://stackoverflow.com/questions/tagged/sencha-architect)


share (http://stackoverflow.com/q/23716326/2677125)|edit (http://stackoverflow.com/posts/23716326/edit)|delete (http://stackoverflow.com/questions/23716326/sencha-extjs-data-in-multiple-referenced-grids/23720274?noredirect=1#)|flag (http://stackoverflow.com/questions/23716326/sencha-extjs-data-in-multiple-referenced-grids/23720274?noredirect=1#)

asked 14 hours ago
https://www.gravatar.com/avatar/60a716efeab558c7774b79285d498775?s=32&d=identicon&r=PG&f=1
(http://stackoverflow.com/users/2677125/user2677125)
user2677125 (http://stackoverflow.com/users/2677125/user2677125)
132


















yeah well ... I suggest you use console.log() to define where is the error... does studentView is pointing to an object? does ClassData ? console.log() them ... code4jhon (http://stackoverflow.com/users/2045079/code4jhon) 14 hours ago (http://stackoverflow.com/questions/23716326/sencha-extjs-data-in-multiple-referenced-grids/23720274?noredirect=1#comment36449531_23716326)










other than pointing to the right objects ... I think ClassID should be 'ClassID': ClassData code4jhon (http://stackoverflow.com/users/2045079/code4jhon) 14 hours ago (http://stackoverflow.com/questions/23716326/sencha-extjs-data-in-multiple-referenced-grids/23720274?noredirect=1#comment36449605_23716326)