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: '无记录' 
            }) 
        });

  • 相关阅读:
    js规范
    JS多个函数多个参数如何动态调用,apply的灵活应用
    我是插件狂人,jDuang,jValidator,jModal,jGallery
    Button在IE6、7下的自适应宽度问题解决方法
    100个直接可以拿来用的JavaScript实用功能代码片段
    docker
    jsonp实现post跨域请求
    setInterval倒计时10s
    CI框架源码解读(1)-入口文件index.php
    为什么开始源码阅读
  • 原文地址:https://www.cnblogs.com/zhaoxd/p/3047596.html
Copyright © 2011-2022 走看看