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

  • 相关阅读:
    js 原生ajax实现
    layer 查看图片
    c# 操作XML
    C# 扩展方法
    c# 依赖注入
    visual studio 快捷键
    HIS系统结算后,没有更新单据状态为“已结算”
    网络流四·最小路径覆盖 HihoCoder
    飞行员配对(二分图最大匹配) 51Nod
    开心的小Q 51Nod
  • 原文地址:https://www.cnblogs.com/baishahe/p/2995777.html
Copyright © 2011-2022 走看看