您是否知道如何在不指定ID的情况下要求用户创建新对象?即我在开发过程中指定ID! 实际上,它不是一种形式,我使用了startEditingNew()函数 这是代码:
isc.ListGrid.create({
ID: "AttributsList",
width:"*", height:370,
alternateRecordStyles:true,
dataSource: crm_attributs,
canReorderRecords: true,
autodraw: false,
selectionType :"single",
autoFetchData: true,
showFilterEditor: false,
canEdit:true,
listEndEditAction: "next",
sortField : "crm_attr_order",
canEdit: true,
editEvent: "doubleClick",
autoSaveEdits:true,
initialCriteria: {crm_attr_fk_kind_idnum : 9999},
fields: [
{name:"crm_attr_fk_kind_idnum", title:"Kind", width:"50", canEdit:true,align:"left", disabled: false}
, {name:"crm_attr_order", title:"Order" ,width:"50",showIf:"true",canEdit:true,align:"left"}
,{name:"crm_attr_name", title:"Name",width:"*" ,align:"left",canEdit:true}
,{name:"crm_attr_datatype", title:"Type" ,width:"40",showIf:"true",canEdit:true,align:"left"}
,{name:"crm_attr_datalist", title:"Datalist", width:"118", canEdit:true ,align:"left"}
,{name:"crm_attr_variable", title:"Variable", width:"118", canEdit:true,align:"left" }
,{name:"crm_attr_min", title:"Min", width:"40", canEdit:true ,align:"left"}
,{name:"crm_attr_max", title:"Max", width:"40", canEdit:true ,align:"left"}
],
gridComponents:["header", "body", Attributes_EditList],
dataChanged : function () {
this.Super("dataChanged", arguments);
var totalRows = this.data.getLength();
if (totalRows > 0 && this.data.lengthIsKnown()) {
totalsLabel.setContents(totalRows + " Attributs");
} else {
totalsLabel.setContents(" ");
}
},
emptyMessage: " Appuyez sur le bouton <b>'+' </b>pour ajouter un nouvel attribut "
});
isc.ToolStrip.create({
ID: "Attributes_EditList",
autodraw: false,
width: "100%", height:24,
members: [
isc.ToolStripButton.create({
icon: "[SKIN]/actions/add.png",
prompt: "add a new attribute",
click:"AttributsList.startEditingNew()"
})
]
});
答案 0 :(得分:0)
我找到了解决方案! 我必须使用这个函数:ListGrid.setEditValue(rowNum,colNum,value)
将要跟踪的字段值修改为未保存的用户编辑。 用于保留未保存的编辑的建议值或重新格式化值。
参数:
rowNum - type: Number
Row number (or edit values ID)
colNum - type: Number | String
Column number of cell, or name of field having editValue updated
value - type: any
New value for the appropriate field.