在struts2 jquery网格中的select格式化程序中获取选定的值
问题描述:
这是我的struts2网格栏
This is my struts2 grid column
<sjg:gridColumn name="interview_notif" index="interview_notif" title="Interview Notification" editable="true" sortable="false" formatter="IntrvNot"/>
这是我用过的格式化程序
And this is the formatter i have used
Function IntrvNot(value, options, rowObject){
var radioHtml = '<select><option value="1">Yes</option><option value="2">No</option></select>';
return radioHtml;
}
The foramatter creates a select with two options but it does not select the one which is in the array.
How do set the selected value to that in the database(array) when the grid populates.
Please help m stuck. Thanks in advance :)
答
function IntrvNot(value, options, rowObject){
var option = {1:"Yes", 2: "No"};
var radioHtml = '<select>';
.each(option,function(key,val){
radioHtml + ='< 选项 value = '+ key +' 已选择 = 已选择 > '+ val +'< / option > ';
});
radioHtml + ='< / select > ; 跨度>';
返回radioHtml;
}
.each(option, function(key, val){ radioHtml+='<option value="'+key+'" selected="selected">'+val+'</option>'; }); radioHtml+='</select>'; return radioHtml; }