您的位置:首页 > 产品设计 > UI/UE

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

2015-11-04 22:34 525 查看
#easyui datagrid  单行操作中的选择行和取消行
#必要条件
#singleSelect:true
#checkOnSelect:true
#selectOncheck:true
</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 && onselect==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:''
});
});



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: