1. #1
    Ext User
    Join Date
    Oct 2008
    Posts
    117
    Vote Rating
    0
    lalit_ce is on a distinguished road

      0  

    Question show gridpanel using button click

    show gridpanel using button click


    hello,
    i want to show grid after button click,
    i have button(admin), and gridpanel

    Code:
    Ext.onReady(function(){
       var myForm = new Ext.form.FormPanel({ 
                                           autoHeight: true 
                        Ext.get('admin').on('click', function(e){
                            
                        });
    
    var grid = new Ext.grid.GridPanel({
          id: 'example',
          title: 'Grid Filters Example',
          ds: ds,
          cm: cm,
          enableColLock: false,
          loadMask: true,
         // plugins: filters,
          height:400,
          width:700,        
          el: 'grid-example',
          autoExpandColumn: 'company',
          bbar: new Ext.PagingToolbar({
            store: ds,
            pageSize: 15,
           // plugins: filters
          }),
          tbar:[{
              text:'update',
              tooltip:'update record',
              iconCls:'add'
          },'-',{
              text:'New',
              tooltip:'save New Record',
              iconCls:'new'
          }]
            
    
       });

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,991
    Vote Rating
    649
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    So move the grid definition inside the callback handler for the button!
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Ext User
    Join Date
    Oct 2008
    Posts
    117
    Vote Rating
    0
    lalit_ce is on a distinguished road

      0  

    Default i cant find reference about callback handler

    i cant find reference about callback handler


    can you give some reference code which show how to use that.
    thank you

  4. #4
    Ext User
    Join Date
    Oct 2008
    Posts
    117
    Vote Rating
    0
    lalit_ce is on a distinguished road

      0  

    Question how to call grid in button handler

    how to call grid in button handler


    hii,
    what i will write in handler function......
    for call grid.......
    Code:
     var myForm = new Ext.form.FormPanel({ 
                                           autoHeight: true,
                                           buttons: [{
                                               text: 'Save',
                           handler: function(){ .........

  5. #5
    Ext User
    Join Date
    Oct 2008
    Posts
    117
    Vote Rating
    0
    lalit_ce is on a distinguished road

      0  

    Question handler function for show grid

    handler function for show grid


    i m new in extjs......
    i have a grid and i want to open grid using button handler function
    Code:
    var ds = new Ext.data.JsonStore({
          url:'http://localhost:88/extjs/admin/admin.php',
        id: 'id',
        totalProperty: 'total',
        root: 'data',
        fields: [
          {name:'id'}, 
          {name:'company'}, 
          {name:'price'}, 
          {name:'date',type: 'date', dateFormat: 'Y-m-d H:i:s'}, 
          {name:'visible'}, 
          {name:'size'}
        ],
          sortInfo: {field: 'company', direction: 'ASC'},
          remoteSort: true
        });
    
    
        var cm = new Ext.grid.ColumnModel([
          {dataIndex: 'id', header: 'Id'},
          {dataIndex: 'company', header: 'Company', id: 'company'},
          {dataIndex: 'price', header: 'Price'},
          {dataIndex: 'date',header: 'Date', renderer: Ext.util.Format.dateRenderer('m/d/Y')}, 
          {dataIndex: 'size', header: 'Size'}, 
          {dataIndex: 'visible',header: 'Visible'}
        ]);
        cm.defaultSortable = true;
            var grid = new Ext.grid.GridPanel({
          id: 'example',
          title: 'Grid Filters Example',
          ds: ds,
          cm: cm,
          enableColLock: false,
          loadMask: true,
         // plugins: filters,
          height:400,
          width:700,        
          el: 'grid-example',
          autoExpandColumn: 'company',
          bbar: new Ext.PagingToolbar({
            store: ds,
            pageSize: 15,
           // plugins: filters
          }),
          tbar:[{
              text:'update',
              tooltip:'update record',
              iconCls:'add'
              handler: function(){
                  
              }
          },'-',{
              text:'New',
              tooltip:'save New Record',
              iconCls:'new'
          }]
    how to write function for this.......???????
    thank you for help....

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    1. Remove el: 'grid-example'.
    2. In the button handler call grid.render('grid-example');

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,991
    Vote Rating
    649
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Please don't post the same thing in multiple threads.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 2