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);
}
添加回答
舉報