-
29 Aug 2012 11:38 PM #1
Answered: pass variable
Answered: pass variable
i hav a controller and my problem is how can i pass variables to my php file so that i can do a new query and fill my store as json out put....
-
Best Answer Posted by redraid
Use proxy extraParams:
Code:searchUser: function(grid, record) {//the grid desplayed from userlist view var SearchGrids = this.getSearchGridsStore(), // or SearchGrids = grid.getStore(), searchId=record.get('id'); SearchGrids.proxy.extraParams.searchId = searchId; SearchGrids.load( callback: function () { // store loaded } }); if (this.searchGridWin) { // close opened window this.searchGridWin.close(); //this.searchGridWin.destroy(); // if window closeAction != 'destroy' uncomment this.searchGridWin = null; } else { this.searchGridWin = Ext.widget('SearchGrid'); this.searchGridWin.show(); } },
-
29 Aug 2012 11:42 PM #2
-
30 Aug 2012 12:42 AM #3
this is how i tried
this is how i tried
my controller
......and on my php pageCode:Ext.define('AM.controller.Users', { extend: 'Ext.app.Controller', views:[ 'user.List','user.Edit','user.West','user.Tabview','user.ReportTree','user.SearchGrid', ], stores:[ 'Users','Policies','SearchGrids', ], models: [ 'User','Gridfill', ], init: function() { this.control({ 'userlist': { itemclick: this.searchUser }, ...........remaining codes.... }); }, searchUser: function(grid, record) {//the grid desplayed from userlist view var searchId=record.get('id'); SearchGrids.load({params: searchId}); var view = Ext.widget('searchGrid'); },// error SearchGrids is not defined and i tried this var SearchGrids= Ext.data.StoreManager.lookup('mystore'); and still the same error...what shall i doCode:$sId=$_POST['searchId']; then do query.....
Last edited by mohaskuar; 30 Aug 2012 at 12:43 AM. Reason: correction
-
30 Aug 2012 1:05 AM #4
Did you try SearchGrids = Ext.data.StoreManager.lookup('SearchGrids')?
-
30 Aug 2012 1:21 AM #5
still the same
still the same
plus 'mystore' is the storeId of my store(SearchGrids);
-
30 Aug 2012 1:51 AM #6
Controller add getters for stores:
Code:searchUser: function(grid, record) {//the grid desplayed from userlist view var SearchGrids = this.getSearchGridsStore(), // or SearchGrids = grid.getStore(), searchId=record.get('id'); SearchGrids.load({ params: { searchId: searchId }, callback: function () { // store loaded } }); },
-
30 Aug 2012 4:45 AM #7
the above
do exactly like i wanted but after loading the view which have a grid that uses SearchGrid the refresh button is not working....because..Code:var SearchGrids= this.getSearchGridsStore(); SearchGrids.load({ params: { searchId: searchId },.......on the php file would be null...after refreshing the grid....how can i solve that.....another is i usedCode:$sId=$_POST['searchId'];
to load the view...so how can i close the first opend view before another one is loaded ....i tried this oneCode:var view=Ext.widget('SearchGrid');
but does not close itCode:Ext.widget('SearchGrid').close();
-
30 Aug 2012 7:10 AM #8
Use proxy extraParams:
Code:searchUser: function(grid, record) {//the grid desplayed from userlist view var SearchGrids = this.getSearchGridsStore(), // or SearchGrids = grid.getStore(), searchId=record.get('id'); SearchGrids.proxy.extraParams.searchId = searchId; SearchGrids.load( callback: function () { // store loaded } }); if (this.searchGridWin) { // close opened window this.searchGridWin.close(); //this.searchGridWin.destroy(); // if window closeAction != 'destroy' uncomment this.searchGridWin = null; } else { this.searchGridWin = Ext.widget('SearchGrid'); this.searchGridWin.show(); } },


Reply With Quote