extjs 动态添加的控件 点击删除后 控件删除了,怎么fieldlabel还显示呢 动态添加的控件 点击删除后 控件删除了,怎么fieldlabel还显示呢extjs 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把3个fieldtext放在一个div或panel中,直接删除div不就得了。 源码贴出来 估计是只删除了 增加的 text输入框 而前面的 说明没有删除 //这是定义的 var oForm = new Ext.FormPanel({ renderTo: 'form_panel', id: 'oForm', layout: "column", baseCls: "x-plain", hideLabels: false, bodyStyle: 'margin-left:5px; margin-top:10px', labelAlign: "right", border: false, items: [{ width: 190, layout: "form", baseCls: "x-plain", labelWidth: 55, border: false, items: [{ xtype: "textfield", labelAlign: "right", fieldLabel: "酒店地址", maxLength: 25, id: 'address0' }] }, { width: 170, layout: "form", baseCls: "x-plain", labelWidth: 35, border: false, items: [{ xtype: "textfield", fieldLabel: "房号", maxLength: 25, id: 'room0' }] }, { width: 175, layout: "form", baseCls: "x-plain", labelWidth: 55, border: false, items: [{ xtype: "datefield", fieldLabel: "入住日期", width: 110, format: 'Y-m-d', id: 'Date0', readOnly: true }] }, { width: 60, layout: "form", baseCls: "x-plain", border: false, items: [{ xtype: "button", text: "+", width: 40, id: 'del0', listeners: { click: function (t, f, s) { add(); //添加 } } }] } ] })//这是方法function add() { var oForm = Ext.getCmp('oForm'); n++; var liveAddr = new Ext.form.TextField({ name: 'address' + n, id: 'address' + n, fieldLabel: '酒店地址' }); var liveAddrinfo = new Ext.form.TextField({ name: 'room' + n, id: 'room' + n, fieldLabel: '房号' }); var liveDay = new Ext.form.DateField({ name: 'Date' + n, id: 'Date' + n, fieldLabel: '入住日期',readOnly :true, width: 110, format: 'Y-m-d' }); var del = new Ext.Button({ name: 'del' + n, id: 'del' + n, text: '-', width: 40, listeners: { click: function (t, f, s) { var id = t.id id = id.substring(3, id.length); if (id) { debugger oForm.items.items[0].remove(Ext.getCmp('address' + id)); oForm.items.items[1].remove(Ext.getCmp('room' + id)); oForm.items.items[2].remove(Ext.getCmp('Date' + id)); oForm.items.items[3].remove(Ext.getCmp('del' + id)); oForm.doLayout(); } } } }); oForm.items.items[0].add(oForm.items.getCount(), liveAddr); deleteInfo(0); oForm.items.items[1].add(oForm.items.getCount(), liveAddrinfo); deleteInfo(1); oForm.items.items[2].add(oForm.items.getCount(), liveDay); deleteInfo(2); //oForm.items.items[3].add(oForm.items.getCount(), del); //deleteInfo(3); oForm.doLayout(); } 求一段ajax代码自动补全和查询信息自动填充 某大公司的面试题寻答案 问题 打开一个已经预编译的网站,怎么进行修改,添加app_code文件夹 [求助]怎么在.net中调试windows服务? 重新定向时的问题! 用户登录的问题 有关Calender的疑问 可以用response.redirect和链接发送变量到指定窗口(frame)吗? C# 操作json 数据,如何删除符合条件的某一行数据? 关于project2010导入问题 小白求大神vs2012 结合 MySQL 实现单点登录
var oForm = new Ext.FormPanel({
renderTo: 'form_panel',
id: 'oForm',
layout: "column",
baseCls: "x-plain",
hideLabels: false,
bodyStyle: 'margin-left:5px; margin-top:10px',
labelAlign: "right",
border: false,
items: [{
width: 190,
layout: "form",
baseCls: "x-plain",
labelWidth: 55,
border: false,
items: [{
xtype: "textfield",
labelAlign: "right",
fieldLabel: "酒店地址",
maxLength: 25,
id: 'address0'
}]
}, {
width: 170,
layout: "form",
baseCls: "x-plain",
labelWidth: 35,
border: false,
items: [{
xtype: "textfield",
fieldLabel: "房号",
maxLength: 25,
id: 'room0'
}] }, {
width: 175,
layout: "form",
baseCls: "x-plain",
labelWidth: 55,
border: false,
items: [{
xtype: "datefield",
fieldLabel: "入住日期",
width: 110,
format: 'Y-m-d',
id: 'Date0',
readOnly: true
}] }, {
width: 60,
layout: "form",
baseCls: "x-plain",
border: false,
items: [{
xtype: "button",
text: "+",
width: 40,
id: 'del0',
listeners: {
click: function (t, f, s) {
add(); //添加
} }
}]
}
]
})
//这是方法function add() {
var oForm = Ext.getCmp('oForm');
n++;
var liveAddr = new Ext.form.TextField({ name: 'address' + n, id: 'address' + n, fieldLabel: '酒店地址' });
var liveAddrinfo = new Ext.form.TextField({ name: 'room' + n, id: 'room' + n, fieldLabel: '房号' });
var liveDay = new Ext.form.DateField({ name: 'Date' + n, id: 'Date' + n, fieldLabel: '入住日期',readOnly :true, width: 110, format: 'Y-m-d' }); var del = new Ext.Button({ name: 'del' + n, id: 'del' + n, text: '-', width: 40, listeners: { click: function (t, f, s) {
var id = t.id
id = id.substring(3, id.length);
if (id) {
debugger
oForm.items.items[0].remove(Ext.getCmp('address' + id));
oForm.items.items[1].remove(Ext.getCmp('room' + id));
oForm.items.items[2].remove(Ext.getCmp('Date' + id));
oForm.items.items[3].remove(Ext.getCmp('del' + id));
oForm.doLayout();
}
}
}
}); oForm.items.items[0].add(oForm.items.getCount(), liveAddr);
deleteInfo(0); oForm.items.items[1].add(oForm.items.getCount(), liveAddrinfo);
deleteInfo(1); oForm.items.items[2].add(oForm.items.getCount(), liveDay);
deleteInfo(2); //oForm.items.items[3].add(oForm.items.getCount(), del);
//deleteInfo(3); oForm.doLayout(); }