ext动态添加行。急。。

田小瘦 2011-10-19 11:46:25
如题, 假如我这里有一行数据需要填写,后面有一个添加的按钮,当我每次点击添加按钮的时候,就在下面自动增加一行出来,我用的FormPanel,

var form = new Ext.form.FormPanel({
collapsible: true,
resizable:false,
frame:true,
labelWidth: 100,
baseCls:'x-panel-noborder',
buttonAlign:'center',
items: [{
layout: 'column',
height: 40,
baseCls: 'background-color:#FFFFFF',
items: [{
xtype: 'label',
columnWidth: .10,
html: '移动通道:',
cls: 'label1'
}, {
xtype:'combo',
id:'ydChannl',
name:'ydChannl',
allowBlank:false,
store : yddyncStore,
emptyText : "请选择",
isFormField : true,
mode : "remote",
triggerAction : "all",
valueField : "value",
displayField : "text",
editable : false,
columnWidth: .30
},{
xtype: 'label',
columnWidth: .20,
html: '通道分配比例:',
cls: 'label1'
},{
xtype: 'combo',
id: 'ydlevel',
name: 'ydlevel',
displayField: 'text',
valueField: 'value',
editable: false,
store: new Ext.data.SimpleStore({
fields: ['value', 'text'],
data: [[0, '0.1'], [1, '0.2']]
}),
triggerAction: 'all',
readOnly: true,
mode: 'local',
value: '1',
columnWidth: .20
},{
xtype: 'button',
columnWidth: .10,
text: '添加',
handler : function() {

}
}]
}]
)}
这就是我的第一行,当我点添加的时候,怎么在添加的function里面写代码,自动在下面添加一行呢?有高手帮帮忙。。谢谢了。
...全文
286 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
yjw0093 2012-05-27
  • 打赏
  • 举报
回复
我也想知道
豆虫 2011-10-19
  • 打赏
  • 举报
回复
这其实就是往items里边add相同的组件就是了
你自己封装一个方法 返回的是一个items 然后点add的时候 panel.add(这个items)就是了
薇薇 2011-10-19
  • 打赏
  • 举报
回复
创建行,然后在insert到grid里面
田小瘦 2011-10-19
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 fanchuanzhidu 的回复:]
这其实就是往items里边add相同的组件就是了
你自己封装一个方法 返回的是一个items 然后点add的时候 panel.add(这个items)就是了
[/Quote]

怎么写这个方法阿?我还是没弄出来,你能根据我上面的代码,写一个出来吗?谢谢阿。。
huangdaxiang0726 2011-10-19
  • 打赏
  • 举报
回复
var gridPanel = Ext.getCmp('idFileList');
var Files = gridPanel.getStore().recordType;
var files = new Files({
file_id:file.id,
file_name:file.name,
file_size:getNiceFileSize(file.size),
file_state:"等待上传",
file_op:"<a href=\"#\" id=\""+file.id+"_del\">取消</a>"
});
gridPanel.getStore().add(files);
gridpanel 动态添加行的方法希望对你有帮助
huaye 2011-10-19
  • 打赏
  • 举报
回复
formpanel.add(你的组件);

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧