0
点赞
收藏
分享

微信扫一扫

easyui datagrid 单行操作中的选择行和取消行

#easyui datagrid  单行操作中的选择行和取消行#必要条件#singleSelect:true#checkOnSelect:true#selectOncheck:true</pre><pre name="code" class="javascript">

</pre><pre name="code" class="javascript">

var onselect = false;
var oncheck = false;
$("#test_table").datagrid({
idField : 'id',
url : 'url',
queryParams:{

},
fitcolumns:true,
fit:false,
height:310,
striped: true ,
pagination:true,
pageNumber:1,
singleSelect:true,
checkOnSelect:true,
selectOncheck:true,
pageSize:10,
pageList:[10,20,30,40,50],
loadMsg : '数据正在加载,请耐心的等待...',
columns : [ [
{field:'check',checkbox: true},
{
field : 'testId',
title : '测试ID',
width : 75,
sortable:true
}


] ],
onSelect:function(index,row){
var select = $("#<span style="font-family: Arial, Helvetica, sans-serif;">test_table</span>").datagrid("getSelected");
if(select!=null && οnselect==true && select.id == row.id){
$("#<span style="font-family: Arial, Helvetica, sans-serif;">test_table</span><span style="font-family: Arial, Helvetica, sans-serif;">").datagrid("unselectAll");</span>
onselect = false;
}else{
onselect = true;
}
},
onCheck:function(index,row){
var check = $("#<span style="font-family: Arial, Helvetica, sans-serif;">test_table</span><span style="font-family: Arial, Helvetica, sans-serif;">").datagrid("getChecked");</span>
if(check!=null && oncheck==true && check[0].id == row.id){
$("#test_table").datagrid("uncheckAll");
oncheck = false;
}else{
oncheck = true;
}
},
toolbar:''
});
});



举报

相关推荐

0 条评论