1 回答
TA贡献1780条经验 获得超1个赞
看看我为你写的新提交函数。列表项存储为列表,其中具有正索引值的项是选定项。然后,您可以访问选定的值。
var timeDialog = {
initialize: function (dialog) { this.loadDefaults(dialog); },
commit: function (dialog) {
this.timeEntry = dialog.store()["tetb"];
var items = dialog.store()["tnlb"]
for (var item in items) {
if (items[item] > 0) {
this.techEntry = item;
break;
}
}
},
loadDefaults: function (dialog) {
dialog.load({
"tnlb":
{
"Jimmy John": +2,
"Papa John": +1,
"Great Gatsby": +0
}
})
},
description:
{
name: "Time Dedicated",
elements:
[
{
type: "view",
elements:
[
{
type: "cluster",
elements:
[
{
name: "Time spent on Request (minutes):",
type: "static_text"
},
{
type: "edit_text",
item_id: "tetb",
char_width: 5
},
{
name: "Technician:",
type: "static_text"
},
{
item_id: "tnlb",
type: "list_box",
width: 200,
height: 60
}
]
},
{
type: "ok_cancel"
}
]
}
]
}
}
if ("ok" == app.execDialog(timeDialog)) {
console.println(timeDialog.timeEntry);
console.println(timeDialog.techEntry);
}
添加回答
举报
