Click here to Skip to main content
15,885,213 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my struts2 grid column
HTML
<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
JavaScript
Function IntrvNot(value, options, rowObject){
 var radioHtml = '<select><option value="1">Yes</option><option value="2">No</option></select>';         
 return radioHtml;
}

SQL
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 :)
Posted
Updated 17-Jul-14 0:50am

1 solution

HTML
function IntrvNot(value, options, rowObject){
    var option = {1:"Yes", 2: "No"};
    var radioHtml = '<select>';
    $.each(option, function(key, val){
        radioHtml+='<option value="'+key+'" selected="selected">'+val+'</option>';
    });
    radioHtml+='</select>';
    return radioHtml;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900