zoukankan      html  css  js  c++  java
  • Ext Grid表格的自动宽度及高度的实现

    希望Ext的表格能自适应外层的div大小,但Ext的Grid构造函数的width、height项不支持100%的设置方式,所以改用以下方式初始化Grid: 

    Ext.get("content").getWidth(), 
    height: Ext.get("content").getHeight(),
     

    <div id="content"> 
        <div id="grid-example"></div> 
    <div> 

    #content { 
    100%; 
    height: 100%; 


    完整js代码: 

    // create the Grid 
        var grid = new Ext.grid.GridPanel({ 
            store: store, 
            columns: [ 
                {id:'id',header: "序号", 50, sortable: true, renderer: keyChange, dataIndex: 'id'}, 
                {header: "数据表表名", 100, sortable: true, renderer: hrefChange, dataIndex: 'tableAlias'}, 
                {header: "物理表名", 100, sortable: true, dataIndex: 'tableName'}, 
                {header: "类型", 75, sortable: true, dataIndex: 'type'} 
            ], 
            stripeRows: true, 
            Ext.get("content").getWidth(), 
            height: Ext.get("content").getHeight(), 
    addClass:"grid", 
    tbar: [{ 
                text: '新增模版', 
                handler : function(){ 
    window.location.href = 'templateDefineList4.html'; 
                } 
                },{ 
                text: '删除模版', 
                handler : function(){ 

                } 
            }], 
            bbar: new Ext.PagingToolbar({ 
                pageSize: 15, 
                store: store, 
                displayInfo: true, 
                displayMsg: '当前显示记录 {0} - {1} 总条数 {2}', 
                emptyMsg: '无记录' 
            }) 
        });

  • 相关阅读:
    2040 打开所有的灯
    1323 删数问题(加强版)
    1087 FBI树
    1030 求先序排列
    1743 矩阵Ⅲ
    svn更新时,出现不知道这样的主机的解决方案
    用jquery或js获取select标签中选中的option值及文本
    html页面中的button按钮会自动提交form表单的问题以及解决方案
    localStorage与sessionStorage的使用和区别
    命令行mvn打包
  • 原文地址:https://www.cnblogs.com/zhaoxd/p/3047596.html
Copyright © 2011-2022 走看看