Hybrid View

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    77
    Answers
    2
    Vote Rating
    0
    mohaskuar is on a distinguished road

      0  

    Default 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....

  2. 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();
       }
    },

  3. #2
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Answers
    44
    Vote Rating
    42
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

  4. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    77
    Answers
    2
    Vote Rating
    0
    mohaskuar is on a distinguished road

      0  

    Default this is how i tried

    this is how i tried


    my controller
    Code:
    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');
        
    },
    ......and on my php page
    Code:
    $sId=$_POST['searchId'];
    then do query.....
    // error SearchGrids is not defined and i tried this var SearchGrids= Ext.data.StoreManager.lookup('mystore'); and still the same error...what shall i do
    Last edited by mohaskuar; 30 Aug 2012 at 12:43 AM. Reason: correction

  5. #4
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Did you try SearchGrids = Ext.data.StoreManager.lookup('SearchGrids')?

  6. #5
    Sencha User
    Join Date
    Jun 2012
    Posts
    77
    Answers
    2
    Vote Rating
    0
    mohaskuar is on a distinguished road

      0  

    Default still the same

    still the same


    plus 'mystore' is the storeId of my store(SearchGrids);

  7. #6
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Answers
    44
    Vote Rating
    42
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default


    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
           }
       });   
    },

  8. #7
    Sencha User
    Join Date
    Jun 2012
    Posts
    77
    Answers
    2
    Vote Rating
    0
    mohaskuar is on a distinguished road

      0  

    Default


    the above
    Code:
     var SearchGrids= this.getSearchGridsStore();
         SearchGrids.load({
           params: {
                searchId: searchId
           },.......
    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:
    $sId=$_POST['searchId'];
    on the php file would be null...after refreshing the grid....how can i solve that.....another is i used
    Code:
    var view=Ext.widget('SearchGrid');
    to load the view...so how can i close the first opend view before another one is loaded ....i tried this one
    Code:
     Ext.widget('SearchGrid').close();
    but does not close it

  9. #8
    Sencha User
    Join Date
    May 2011
    Location
    Ukraine, Rivne
    Posts
    247
    Answers
    44
    Vote Rating
    42
    redraid has a spectacular aura about redraid has a spectacular aura about redraid has a spectacular aura about

      0  

    Default


    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();
       }
    },

Thread Participants: 2

Tags for this Thread