[英]How can I add the log into a jqgrid column?
这是我正在尝试的示例代码。
{
name : 'scopeName',
index : 'scopeName',
width: '400px',
resizable : true,
align : "left",
editable : true,
edittype : "select",
editoptions : {
value : getSequenceNumbers()
},
editrules : {
required : true
}
function:
function getSequenceNumbers() {
alert("here123");
$.getJSON("http://localhost:8039/ReleaseManagementApp/releasemgmt/config/Q2FY16/scope", null, function(data) {
if (data != null) {
alert("here");
//construct string.
//(or the server could return a string directly)
for (var i=0; i<data.length; i++) {
sel.append('<option value="' + data[i].scopeName + '">' + data[i].scopeName + '</option>');
}
}
});
}
这是来自server-link的json数据。
data:
[
{
"scopeId": 101,
"scopeName": "FCM Attributes to be captured in CG1 OM",
"scopeDesc": "New Attributes to be captured in FCM",
"scopeIdentifier": "Q2FY16_FCM_Attributes_to_be_ca"
},
{
"scopeId": 104,
"scopeName": "PBI000000043281",
"scopeDesc": "OMLSS-OM-Production Bug- Workflow-Line Workflow purged even before Line is closed",
"scopeIdentifier": "FY16_OCT_MR_PBI000000043281"
},
{
"scopeId": 106,
"scopeName": "PBI000000049219",
"scopeDesc": "AS-T Inbound and re-process program issues",
"scopeIdentifier": "FY16_OCT_MR_PBI000000049219"
}
]
我想知道是否可以将上述响应中的scopeName填充到jqgrid中作为选择选项卡。
相反,我建议您为此使用自定义格式化程序:
{
name : 'scopeName',
index : 'scopeName',
width: '400px',
resizable : true,
align : "left",
formatter:getSequenceNumbers // <----use the function here
}
现在您可以从此函数返回一个select元素:
function getSequenceNumbers() {
alert("here123");
var sel = '<select>';
sel +='<option value="select">Select...</option>';
$.getJSON("url", null, function(data) {
if (data != null) {
alert("here");
//construct string.
//(or the server could return a string directly)
for (var i=0; i<data.length; i++) {
sel += '<option value="' + data[i].scopeName + '">'
+ data[i].scopeName + '</option>';
}
sel +="</select>";
}
});
return sel;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.