rss· 投稿· 设为首页· 加入收藏· 繁體版
当前位置: 火魔网 » 程序开发 » Javascript

extjs grid水平滚动条

// 重构Grid
 Grid.superclass.constructor.call(this, {
    region : 'center',
    autoScroll : true,
    enableColumnMove : true, // grid的列是否可以移动
    enableHdMenu : true, // 在列的header是否要有下拉菜单
    trackMouseOver : true, // 当鼠标移过行时,行是否要highlight
    stripeRows : true, // 让grid相邻两行背景色不同
    cm : cm,
    ds : ds,
    loadMask : {
     msg : '下载中...'
    },
    viewConfig : {//出现水平滚动条
     layout : function() {
      if (!this.mainBody) {
       return; // not rendered
      }
      var g = this.grid;
      var c = g.getGridEl();
      var csize = c.getSize(true);
      var vw = csize.width;
      if (!g.hideHeaders && (vw < 20 || csize.height < 20)) { // display:
       // none?
       return;
      }
      if (g.autoHeight) {
       if (this.innerHd) {
        this.innerHd.style.width = (vw) + 'px';
       }
      } else {
       this.el.setSize(csize.width, csize.height);
       var hdHeight = this.mainHd.getHeight();
       var vh = csize.height - (hdHeight);
       this.scroller.setSize(vw, vh);
       if (this.innerHd) {
        this.innerHd.style.width = (vw) + 'px';
       }
      }
      if (this.forceFit) {
       if (this.lastViewWidth != vw) {
        this.fitColumns(false, false);
        this.lastViewWidth = vw;
       }
      } else {
       this.autoExpand();
       this.syncHeaderScroll();
      }
      this.onLayout(vw, vh);
     }
    },
    border : false,
    bbar : bbar,
    tbar : tbar
   });

}
// 为Grid添加处理函数
Ext.extend(Grid, Ext.grid.GridPanel, {});

顶一下
(0)
踩一下
(1)