We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29661
    • 116 Posts
    Hello,

    is it possible to load grid column headers from database?

    Here is my simple grid, I want to load fields and columns from database, is it possible (trying this for about 3 weeks and I am desperate...)?

    Bookit.grid.Board = function(config) {
        config = config || {};
        Ext.applyIf(config,{
            id: 'bookit-grid-board'
            ,url: Bookit.config.connectorUrl
            ,baseParams: { action: 'mgr/bookit/getReservations' }
            ,fields: ['id','time', 'item-0']
            ,autosave: true
            ,paging: true
            ,remoteSort: true
            ,enableDragDrop: false
            ,enableColumnMove: false
            ,anchor: '97%'
            ,autoExpandColumn: 'name'
            ,columns: [{
            	header: _('bookit.time')
            	,dataIndex: 'time'
            },{
                header: 'Kurt 1'
                ,dataIndex: 'item-0'
            }]
        });
        Bookit.grid.Board.superclass.constructor.call(this,config);
    };
      --
      John
      @theboxer
      • 28215
      • 4,149 Posts
      No; you'd have to load them from the PHP controller and put them in JSON, then insert them before your grid instantiates. You can't do it from the processor.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 29661
        • 116 Posts
        Thanks,

        I got it smiley [ed. note: TheBoxer last edited this post 14 years, 10 months ago.]
          --
          John
          @theboxer