一、使用datagrid實現列表table,注意參數spa
singleSelect:true,
二、formatter ID的顯示code
frozenColumns:[[{ field:'id', hidden:false, formatter: function(value, rowData, rowIndex){ return '<input type="radio" name="selectRadio" id="selectRadio"' + rowIndex + ' value="' + rowData.id + '" />'; } }]],
三、實現單選選擇變幻,增長事件onClickRoworm
onClickRow: function(rowIndex, rowData){ //加載完畢後獲取全部的checkbox遍歷 var radio = $("input[type='radio']")[rowIndex].disabled; //若是當前的單選框不可選,則不讓其選中 if (radio!= true) { //讓點擊的行單選按鈕選中 $("input[type='radio']")[rowIndex].checked = true; } else { $("input[type='radio']")[rowIndex].checked = false; } }