zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    在HTML文件中加载js
    HTML表单的问题
    HTML自动换行的问题
    HTML的结束标签问题
    数据库基本知识
    PHP中数据库的连接
    2014年7月
    3.2版本视频讲解知识点
    2014年7月
    选项卡
  • 原文地址:https://www.cnblogs.com/baishahe/p/2995777.html
Copyright © 2011-2022 走看看