• EXTJS gridpanel 动态设置表头


    EXTJS gridpanel 动态设置表头,用reconfigure方法

    var col = "([{ text :'Company', flex : 1, sortable : false, dataIndex:'company'},{ text:'Stock Price', columns:[{ text :'Price', width : 75, sortable : true, dataIndex:'price'},{ text :'Change', width : 75, sortable : true, dataIndex:'change'},{ text :'% Change', width : 75, sortable : true, dataIndex:'pctChange'}]},{ text :'Last Updated', width : 85, sortable : true, dataIndex:'lastChange'}])";
            var cols = eval(col);
            // Ext.findCmp('testgrid', this).columns.add(cols);
            //var grid = Ext.getCmp('testgrid'); //Ext.findCmp('testgrid', this).columns;
     

             Ext.findCmp('testgrid', this).reconfigure(null, cols);

           //findCmp是自定义根据类id查找控件id的方法

    以下是EXTJS api说明

    reconfigure( [Ext.data.Store store], [Object[] columns] )

    Reconfigures the table with a new store/columns. Either the store or the columns can be ommitted if you don't wish to change them.

    Parameters

    • store : Ext.data.Store (optional)

      The new store.

    • columns : Object[] (optional)

      An array of column configs

  • 相关阅读:
    Tarjan 的一些板子
    对 SAM 和 PAM 的一点理解
    一些敲可爱的数论板子
    异常
    面向对象编程
    JAVA数组
    JAVA方法
    JAVA流程控制
    JAVA基础
    JAVA入门
  • 原文地址:https://www.cnblogs.com/baishahe/p/2995777.html
Copyright © 2020-2023  润新知