You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.5 KiB
63 lines
2.5 KiB
'use strict';
|
|
var fnPageInit = function () {
|
|
var customOptions = [],
|
|
canDo = new CanDo({
|
|
inserting: true,
|
|
sortField: 'OrderByValue',
|
|
sortOrder: 'asc',
|
|
/**
|
|
* 當前程式所有ID名稱集合
|
|
*/
|
|
idKeys: ['OrgID', 'QuestionID'],
|
|
/**
|
|
* Grid欄位設置(可以是 function)
|
|
*/
|
|
gridFields: [
|
|
{ name: "RowIndex", title: 'common.RowNumber', align: 'center', width: 50, sorting: false },
|
|
{ name: "QuestionName", title: 'QuestionMaintain_Upd.QuestionName', width: 300, type: "text" },
|
|
{ name: "AnswerType", title: 'QuestionMaintain_Upd.AnswerType', width: 300, editing: false, type: "select", items: customOptions, valueField: "ArgumentID", textField: "ArgumentValue"},
|
|
// { name: "Subcategory", title: 'QuestionMaintain_Upd.Subcategory', width: 300 },
|
|
{ type: "control" }
|
|
],
|
|
/**
|
|
* 頁面初始化
|
|
* @param {Object} pargs CanDo 對象
|
|
*/
|
|
pageInit: function (pargs) {
|
|
var postArray = [];
|
|
postArray.push(SetStandardOptions(), SetCustomOptions());
|
|
$.whenArray(postArray).done(function (res) {
|
|
console.log(customOptions)
|
|
pargs._reSetQueryPm();
|
|
pargs._initGrid();
|
|
});
|
|
}
|
|
});
|
|
var AnswerOptionMethod = "GetStandardAnswerOptions"
|
|
var QuestionType = "QuestionType"
|
|
var StandardQuestionID = "01"
|
|
var CustomQuestionID = "02"
|
|
var SetStandardOptions = function () {
|
|
return g_api.ConnectLite(canDo.ProgramId, AnswerOptionMethod, { ArgumentID: QuestionType, ParentArgument: StandardQuestionID },
|
|
function (res) {
|
|
if (res.RESULT) {
|
|
//var saList = res.DATA.rel;
|
|
//var sOptionHtml = createOptions(saList, 'RegionID', 'RegionName', true);
|
|
//$('#RegionID').html(sOptionHtml);
|
|
}
|
|
});
|
|
};
|
|
var SetCustomOptions = function () {
|
|
return g_api.ConnectLite(canDo.ProgramId, AnswerOptionMethod, { ArgumentID: QuestionType, ParentArgument: CustomQuestionID },
|
|
function (res) {
|
|
if (res.RESULT) {
|
|
customOptions = res.DATA.rel
|
|
var sOptionHtml = createOptions(customOptions, 'ArgumentID', 'ArgumentValue', false);
|
|
$('#AnswerType').html(sOptionHtml);
|
|
}
|
|
});
|
|
};
|
|
|
|
};
|
|
|
|
require(['base', 'jsgrid', 'cando'], fnPageInit);
|