zoukankan      html  css  js  c++  java
  • Ext4.1 grid 多选(可无checkbox

    在Ext4.1中的grid默认只能实现单选的。

    如果你想要你的grid有多选功能,需要给grid增加selModel

    如果你使用了Ext.create('Ext.selection.CheckboxModel')-->selModel:Ext.create('Ext.selection.CheckboxModel',{mode:"SIMPLE"})

    部分代码:

    this.grid= new Ext.grid.GridPanel({
                title : 'users',
                store : this.userStore,
                columns : [ {
                    header : "用户ID",
                    sortable : true,
                    dataIndex : 'userId'
                }, {
                    header : "用户名称",
                    sortable : true,
                    dataIndex : 'userName'
                } ],
                stripeRows : true,
                manageHeight:true,
                height:this.height-114,
                selModel:Ext.create('Ext.selection.CheckboxModel',{mode:"SIMPLE"}),

     

     

    界面效果:

     

     

    但是这种方式会出现复选框,

     

    如果不想有复选框是需要把selModel换成Ext.create('Ext.selection.RowModel',{mode:"SIMPLE"})就ok了

     

    如图:

     

     

     

     

    获得选中的数据用var records = this.grid.getSelectionModel().getSelection();就可以了

    (本文转载他出,地址不详)

  • 相关阅读:
    restapi(6)- do it the functional way, 重温函数式编程
    JS模块化
    socket.io websocket
    CSS 文字换行
    webpack初识
    升级nodejs至最新
    JavaScript Promise迷你书(中文版)
    时间格式化
    npm yarn
    深入浅出MongoDB应用实战开发
  • 原文地址:https://www.cnblogs.com/Txy915423012/p/3544483.html
Copyright © 2011-2022 走看看