Jquery 如何将日志添加到jqgrid列中?
这是我正在尝试的示例代码Jquery 如何将日志添加到jqgrid列中?,jquery,jqgrid,Jquery,Jqgrid,这是我正在尝试的示例代码 { name : 'scopeName', index : 'scopeName', width: '400px', resizable : true, align : "left", editable : true, edittype : "select", editoptions : { value : getSeq
{
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>');
}
}
});
}
我想知道是否可以将上述响应中的scopeName作为选择选项卡填充到jqgrid中。相反,我建议您为此使用自定义格式化程序:
{
name : 'scopeName',
index : 'scopeName',
width: '400px',
resizable : true,
align : "left",
formatter:getSequenceNumbers // <----use the function here
}
{
名称:“scopeName”,
索引:“scopeName”,
宽度:“400px”,
可调整大小:正确,
对齐:“左”,
格式化程序:GetSequenceNumber//
{
name : 'scopeName',
index : 'scopeName',
width: '400px',
resizable : true,
align : "left",
formatter:getSequenceNumbers // <----use the function here
}
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;
}