美文网首页
2021-04-28

2021-04-28

作者: 跨栏高手东莞仔 | 来源:发表于2021-04-28 18:09 被阅读0次

2021/04/27:

1 Ext.grid.Panel类

1创建你的数据模型

var store = Ext.create('Ext.data.Store', {

        id: 'simpsonsStore',

        autoLoad: false,

        fields: ['name', 'email', 'phone'],   

        pageSize: itemsPerPage, // items per page

        proxy: {

            type: 'ajax',

            // url that will load data with respect to start and limit params

            url: '/myuser',

            reader: {

                type: 'json',

                rootProperty: 'data',

                totalProperty: 'total'

            }

        }

    });

2、Ext.selection.Model类(创造复选框)

列出数据绑定的组件中已经选择的记录,这是一个抽象类不能具体使用,需要结合Ext.grid.Panel

和Ext.tree.Panel一起使用,子类是CheckboxModel, 实例化 var sm = new Ext.selection.CheckboxModel();

Ext.create('Ext.grid.Panel',{selModel:sm},这样我们的表格可以带上复选框了

3、Ext.button.Button类

按钮组件类,用来创建按钮,并且可以绑定

Ext.create('Ext.Button', {

    text: 'Click me',

    renderTo: Ext.getBody(),

    handler: function() {

        alert('You clicked the button!');

    }

});

如果需要给按钮添加图标,需要配置iconCls,两种方式,一种自定义,一种结合fontawesome

iconCls:'my-home-icon'

.my-home-icon{background-image:url(../images/my-home-icon.gif)!important;}

或者

iconCls:'x-fa fa-home'

4、Ext.grid.Panel与Ext.Button.Button类结合实现表格的删除操作

Ext.create('Ext.grid.Panel', {

tbar:[

{ xtype: 'button', text: '删除', iconCls: "fa fa-minus-square",function(){

 // 回调函数会传给我们当前按钮的Button类实例化对象,我们可以用方法findParentByType

                    // var grid = o.findParentByType('gridpanel')

                    var grid = o.ownerCt.ownerCt

                    var data = grid.getSelectionModel().getSelection()

                    if (data.length === 0) {

                        Ext.Msg.alert("提示", "您最少要选择一条数据")

                    } else {

                        var ids = []

                        Ext.Array.each(data, function (record) {

                            ids.push(record.get('id'))

                        })

                        Ext.Ajax.request({

                            url: '/deluser',

                            method : 'post',

                            dataType:'json',

                            headers: {'Content-Type':'application/json'},

                            jsonData:{ids},

                            success: function (response, opt) {

                                console.log(response,111)

                                if(response.status===200){

                                    Ext.Array.each(data,function(record){

                                        store.remove(record)

                                    })

                                }

                            }

                        })

                    }

} }

]

})

5、Ext.grid.column.Action 类

        

   

相关文章

  • 故乡的河

    作者:小小鱼 2021-04-28 有人喜欢故乡的月亮,有人喜欢故乡的草地,而我喜欢故乡的小河。 ...

  • bitshares比特股数据20210428

    2021-04-28比特股BTS大额转账的记录 时间转出转入BTS数量00:34:54zbbts001zbsend...

  • 20210428《股票投资的24堂课》

    缘起 忘记啥时候开始的了,全书计划10个番茄钟,2021-04-28读完,用时6个。 作者William J.O....

  • 相机基础知识(一)

    2021-04-28 周三 在b站看的一个不错的视频教程[https://www.bilibili.com/vid...

  • 42、星光灿烂,照亮天空

    本文编号42,首发于2021-04-28,如果喜欢我的内容,可以多多点赞,收藏,分享,给个支持。 1 昨天在西瓜视...

  • 底线

    我怎么如此幸运-99将帅挑战赛53-重生235-戴红霞(2021-04-28) 我怎么如此幸运-底线 1.我怎么如...

  • 2021-04-28 探索ikigai

    【2021-04-28 日精进 第316天 】 体验-感受-情绪 5组晨会,主题是4月月度复盘和目标达成,主持人...

  • 第八期牛转乾坤21天特训营第 11天打卡

    【日期】2021-04-28 【姓名】黄晓 早起立心立命+安全感时间:60分钟 链接爱光莲花时长40分钟 第一次...

  • 跟璇子一起打造个人IP(15)

    跟璇子一起打造个人IP 2021-04-28 第15天 昨天在武汉发现经过的每一家茶颜悦色都在排长队,相信你也跟很...

  • 2021-04-28

    虽然每天早上背前一天的知识点 导致时间每天能做的事变少了 但总算不再是学完之后 脑袋空空的了 进度慢就进度慢吧 光...

网友评论

      本文标题:2021-04-28

      本文链接:https://www.haomeiwen.com/subject/hcevrltx.html