开发者

Radio Buttons in a jqGrid

Basically, I am trying to include radio buttons in a jqGrid. I can see that we can use a custom formatter for this. Following is my code, which does not tell me which radio button is selected/ or whether it is selected or not.

the value is "undefined" all the times.

// The custom开发者_如何学JAVA formatter definition
function radio(value, options, rowObject){
   var radioHtml = '<input type="radio" value=' + value + ' name="radioid" />';
   return radioHtml;
}

// Snippet of the colModel in jqGrid definition
colModel:[
    {name:'select', label:'Select', width: 60, align:'center', edittype:'custom', 
     editable:true, formatter: radio},
    {name:'name', label: 'Source Disk Volume', width: 170}],

// The method called on submit
function evaluate() {
    // try 1
    alert('val: '+$("[name='radioid']:checked").val()); 

    // try 2
    tried accessing the checked radio button through simple javascript 
}

Please help me access the value of the radio button which is selected by the user.


gridComplete: function () {
    $("td[aria-describedby=jqgridName_select] input[type='radio']").click(function () {
        alert($(this).val());
    });
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜