本文介绍了如何在 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 的网格视图列中添加按钮?
发布评论