87,984
社区成员
发帖
与我相关
我的任务
分享
var rowEditing = new Ext.grid.plugin.RowEditing({
clicksToEdit: 2,
saveBtnText: '保存',
cancelBtnText: "取消",
autoCancel: false,
listeners: {
beforeedit: function (editor, e, eOpts) {
setTimeout(function () {
Ext.getCmp("editPartner").setValue(e.record.get('Partner').ID);
Ext.getCmp("editBEGINTIME").setValue(eval('new ' + (e.record.get('BEGINTIME').replace(/\//g, ''))));
Ext.getCmp("editENDTIME").setValue(eval('new ' + (e.record.get('ENDTIME').replace(/\//g, ''))));
}, 100);
},
edit: function (editor, e, eOpts) {
var name = "";
for (var i = 0; i < pjson.length; i++) {
if (Ext.getCmp("editPartner").getValue() == pjson[i]["ID"]) {
name = pjson[i]["NAME"];
break;
}
}
e.record.set('Partner', { ID: Ext.getCmp("editPartner").getValue(),NAME:name });
e.record.commit();
}
}
});
[/quote]
ext没有输入控件生成完毕后的事件,所以需要延时执行下才能获取到到render后的输入控件var rowEditing = new Ext.grid.plugin.RowEditing({
clicksToEdit: 2,
saveBtnText: '保存',
cancelBtnText: "取消",
autoCancel: false,
listeners: {
beforeedit: function (editor, e, eOpts) {
setTimeout(function () {
Ext.getCmp("editPartner").setValue(e.record.get('Partner').ID);
Ext.getCmp("editBEGINTIME").setValue(eval('new ' + (e.record.get('BEGINTIME').replace(/\//g, ''))));
Ext.getCmp("editENDTIME").setValue(eval('new ' + (e.record.get('ENDTIME').replace(/\//g, ''))));
}, 100);
},
edit: function (editor, e, eOpts) {
var name = "";
for (var i = 0; i < pjson.length; i++) {
if (Ext.getCmp("editPartner").getValue() == pjson[i]["ID"]) {
name = pjson[i]["NAME"];
break;
}
}
e.record.set('Partner', { ID: Ext.getCmp("editPartner").getValue(),NAME:name });
e.record.commit();
}
}
});
var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
clicksToMoveEditor: 2,
autoCancel: false, listeners: { beforeedit: function (editor, e, eOpts) {
setTimeout(function () {
var x =document.getElementById('xxxx');
x.value = e.record.get('Partner').NAME;
}, 100)
}, edit: function (editor, e, eOpts) {
var x = document.getElementById('xxxx');
e.record.set('Partner', { NAME: x.value });
e.record.commit();
}
}
});
{
header: '举办方',
dataIndex: 'Partner',
editor: {
allowBlank: false, inputId: 'xxxx'
}
}
startdt的内容要改为时间对象,而不是字符串。如 "startdt":"Date(1438272000000)",你要改成"startdt":new Date(1438272000000),这样startdt才是时间,而不是字符串。要不直接显示你的startdt内容,因为不是时间对象,虽然你那列添加了renderer进行格式化