如何在 extjs 的网格视图列中添加按钮?

编程入门 行业动态 更新时间:2024-10-27 02:18:25
本文介绍了如何在 extjs 的网格视图列中添加按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当创建新行时,一个字段应该包含一个在扩展JS中动态创建的按钮.

When new row is created, then one field should contain a button created dynamically in Extended JS.

每个按钮应包含不同的名称和动作侦听器.该列应该像图像中给出的那样.

Each button should contain different name and action listener. The column should like given in image.

推荐答案

{ xtype: 'gridpanel', columns: [ {text: 'NAME', dataIndex: 'name', width: 100}, {text: 'SURNAME', dataIndex: 'surname', width: 100}, { text: 'DELETE', align: 'center', xtype: 'actioncolumn', items: [ { xtype: 'button', text: 'DELETE ME', scale: 'small', handler: function() { alert("Hello World!"); } } ] } ] }

下一次尝试:

{ xtype: 'gridpanel', columns: [ {text: 'NAME', dataIndex: 'name', width: 100}, {text: 'SURNAME', dataIndex: 'surname', width: 100}, { renderer: function(val,meta,rec) { // generate unique id for an element var id = Ext.id(); Ext.defer(function() { Ext.widget('button', { renderTo: Ext.query("#"+id)[0], text: 'DELETE', scale: 'small', handler: function() { Ext.Msg.alert("Hello World") } }); }, 50); return Ext.String.format('<div id="{0}"></div>', id); } } ] }

更多推荐

如何在 extjs 的网格视图列中添加按钮?

本文发布于:2023-05-29 15:07:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/347273.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:词库加载错误:Could not find file &#039;D:\淘小白 高铁采集器win10\Configuration\Dict_Sto

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!