easyui datagrid 多列都有checkbox有人做过吗 嗯 是有多2列有checkbox框怎么做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 {field : 'id',title:'',width:10,checkbox:true},{field : 'name1',title:'name1',width:10,checkbox:true},{field : 'name2',title:'name2',width:10,checkbox:true}... 那你要实现的就是单元格选择了?那你用field的editor属性试试,type=checkbox <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Complex DataGrid - jQuery EasyUI Demo</title> <link rel="stylesheet" type="text/css" href="../themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="../themes/icon.css"> <link rel="stylesheet" type="text/css" href="demo.css"> <script type="text/javascript" src="../jquery-1.6.min.js"></script> <script type="text/javascript" src="../jquery.easyui.min.js"></script> <script> $(function(){ $('#test').datagrid({ title:'My DataGrid', iconCls:'icon-save', width:700, height:350, nowrap: false, striped: true, collapsible:true, url:'datagrid_data.json', sortName: 'code', sortOrder: 'desc', remoteSort: false, idField:'code', frozenColumns:[[ {field:'ck',checkbox:true}, {title:'code',field:'code',width:80,sortable:true} ]], columns:[[ {title:'Base Information',colspan:3}, {field:'opt',title:'Operation',width:100,align:'center', rowspan:2, formatter:function(value,rec){ return '<span style="color:red">Edit Delete</span>'; } } ],[ {field:'name',title:'Name',width:120}, {field:'addr',title:'Address',width:220,rowspan:2,sortable:true, sorter:function(a,b){ return (a>b?1:-1); } }, {field:'col4',title:'Col41',width:150,rowspan:2} ]], pagination:true, rownumbers:true, toolbar:[{ id:'btnadd', text:'Add', iconCls:'icon-add', handler:function(){ $('#btnsave').linkbutton('enable'); alert('add') } },{ id:'btncut', text:'Cut', iconCls:'icon-cut', handler:function(){ $('#btnsave').linkbutton('enable'); alert('cut') } },'-',{ id:'btnsave', text:'Save', disabled:true, iconCls:'icon-save', handler:function(){ $('#btnsave').linkbutton('disable'); alert('save') } }] }); var p = $('#test').datagrid('getPager'); $(p).pagination({ onBeforeRefresh:function(){ alert('before refresh'); } }); }); function resize(){ $('#test').datagrid('resize', { width:700, height:400 }); } function getSelected(){ var selected = $('#test').datagrid('getSelected'); if (selected){ alert(selected.code+":"+selected.name+":"+selected.addr+":"+selected.col4); } } function getSelections(){ var ids = []; var rows = $('#test').datagrid('getSelections'); for(var i=0;i<rows.length;i++){ ids.push(rows[i].code); } alert(ids.join(':')); } function clearSelections(){ $('#test').datagrid('clearSelections'); } function selectRow(){ $('#test').datagrid('selectRow',2); } function selectRecord(){ $('#test').datagrid('selectRecord','002'); } function unselectRow(){ $('#test').datagrid('unselectRow',2); } function mergeCells(){ $('#test').datagrid('mergeCells',{ index:2, field:'addr', rowspan:2, colspan:2 }); } </script></head><body> <h2>Complex DataGrid</h2> <div class="demo-info"> <div class="demo-tip icon-tip"></div> <div>Click the button to do actions with datagrid.</div> </div> <div style="margin:10px 0;"> <a href="#" onclick="getSelected()">GetSelected</a> <a href="#" onclick="getSelections()">GetSelections</a> <a href="#" onclick="selectRow()">SelectRow</a> <a href="#" onclick="selectRecord()">SelectRecord</a> <a href="#" onclick="unselectRow()">UnselectRow</a> <a href="#" onclick="clearSelections()">ClearSelections</a> <a href="#" onclick="resize()">Resize</a> <a href="#" onclick="mergeCells()">MergeCells</a> </div> <table id="test"></table> </body></html>可以实现的,例子 设置选中行的时候,checkbox不选中,选中checkbox的时候,不选中行,设置如下: checkOnSelect:false, selectOnCheck:false,还有一种方法,使用formatter生成checkbox,那么选中checkbox的时候,也不会关联选中整行了。 function deleteCheckBoxEvent(eventName){ $("#messageBox1").unbind(eventName); $("#emailBox1").unbind(eventName); $("#payBox1").unbind(eventName); $("#all").unbind(eventName);}解释:解除掉checkbox的click事件。如果再一次从后台读数据刷新表格,继续解除。 设置singleSelect为false,可以选择多列 为什么我的不行呢?deleteCheckBoxEvent(“click”)吗? 求一个点击变换背景图片css的菜单导航。。。。。 提示form未定义 错误 可算明明已经给form定义名字了啊 邮件发送502 :command not implemented 奇怪的问题,不知道哪里出错了,高手帮忙看看哪里出错了 JAVASCRIPT小问题,如果能解决,将送100M支持数据库空间!!!! 求一个日期的正则表达式 将变量转变为JS对象的问题,急求解!!!在线等待 屏蔽按键 VBSCRIPT 中如何调用Dll???? 俺们坛里什么都有,就是搜不到数学型的问题,俺有个问题请教大家用js编出来! 请教一句javascript 语句意思。 javascript获取服务器IP
{field : 'name1',title:'name1',width:10,checkbox:true},
{field : 'name2',title:'name2',width:10,checkbox:true}...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Complex DataGrid - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<link rel="stylesheet" type="text/css" href="demo.css">
<script type="text/javascript" src="../jquery-1.6.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script>
$(function(){
$('#test').datagrid({
title:'My DataGrid',
iconCls:'icon-save',
width:700,
height:350,
nowrap: false,
striped: true,
collapsible:true,
url:'datagrid_data.json',
sortName: 'code',
sortOrder: 'desc',
remoteSort: false,
idField:'code',
frozenColumns:[[
{field:'ck',checkbox:true},
{title:'code',field:'code',width:80,sortable:true}
]],
columns:[[
{title:'Base Information',colspan:3},
{field:'opt',title:'Operation',width:100,align:'center', rowspan:2,
formatter:function(value,rec){
return '<span style="color:red">Edit Delete</span>';
}
}
],[
{field:'name',title:'Name',width:120},
{field:'addr',title:'Address',width:220,rowspan:2,sortable:true,
sorter:function(a,b){
return (a>b?1:-1);
}
},
{field:'col4',title:'Col41',width:150,rowspan:2}
]],
pagination:true,
rownumbers:true,
toolbar:[{
id:'btnadd',
text:'Add',
iconCls:'icon-add',
handler:function(){
$('#btnsave').linkbutton('enable');
alert('add')
}
},{
id:'btncut',
text:'Cut',
iconCls:'icon-cut',
handler:function(){
$('#btnsave').linkbutton('enable');
alert('cut')
}
},'-',{
id:'btnsave',
text:'Save',
disabled:true,
iconCls:'icon-save',
handler:function(){
$('#btnsave').linkbutton('disable');
alert('save')
}
}]
});
var p = $('#test').datagrid('getPager');
$(p).pagination({
onBeforeRefresh:function(){
alert('before refresh');
}
});
});
function resize(){
$('#test').datagrid('resize', {
width:700,
height:400
});
}
function getSelected(){
var selected = $('#test').datagrid('getSelected');
if (selected){
alert(selected.code+":"+selected.name+":"+selected.addr+":"+selected.col4);
}
}
function getSelections(){
var ids = [];
var rows = $('#test').datagrid('getSelections');
for(var i=0;i<rows.length;i++){
ids.push(rows[i].code);
}
alert(ids.join(':'));
}
function clearSelections(){
$('#test').datagrid('clearSelections');
}
function selectRow(){
$('#test').datagrid('selectRow',2);
}
function selectRecord(){
$('#test').datagrid('selectRecord','002');
}
function unselectRow(){
$('#test').datagrid('unselectRow',2);
}
function mergeCells(){
$('#test').datagrid('mergeCells',{
index:2,
field:'addr',
rowspan:2,
colspan:2
});
}
</script>
</head>
<body>
<h2>Complex DataGrid</h2>
<div class="demo-info">
<div class="demo-tip icon-tip"></div>
<div>Click the button to do actions with datagrid.</div>
</div>
<div style="margin:10px 0;">
<a href="#" onclick="getSelected()">GetSelected</a>
<a href="#" onclick="getSelections()">GetSelections</a>
<a href="#" onclick="selectRow()">SelectRow</a>
<a href="#" onclick="selectRecord()">SelectRecord</a>
<a href="#" onclick="unselectRow()">UnselectRow</a>
<a href="#" onclick="clearSelections()">ClearSelections</a>
<a href="#" onclick="resize()">Resize</a>
<a href="#" onclick="mergeCells()">MergeCells</a>
</div>
<table id="test"></table>
</body>
</html>可以实现的,例子
checkOnSelect:false,
selectOnCheck:false,
还有一种方法,使用formatter生成checkbox,那么选中checkbox的时候,也不会关联选中整行了。
$("#messageBox1").unbind(eventName);
$("#emailBox1").unbind(eventName);
$("#payBox1").unbind(eventName);
$("#all").unbind(eventName);
}
解释:解除掉checkbox的click事件。如果再一次从后台读数据刷新表格,继续解除。
为什么我的不行呢?deleteCheckBoxEvent(“click”)吗?