easyui treegrid 复选框有关问题
easyui treegrid 复选框问题
点击复选框时只能单选,不知道什么问题,求大侠们指教
源码
//设置treegrid自适应
$(window).resize(function(){
$('#treeGrid').treegrid('resize', {
width: '100%'
})
});
//js获取项目根路径,如: http://localhost:8088/jquery
function getRootPath(){
//获取当前网址,如: http://localhost:8088/jquery/easyui/login.jsp
var curWwwPath = window.document.location.href;
//获取主机地址之后的目录,如: jquery/easyui/login.jsp
var pathName = window.document.location.pathname;
var pos = curWwwPath.indexOf(pathName);
//获取主机地址,如: http://localhost:8088
var localhostPaht = curWwwPath.substring(0, pos);
//获取带"/"的项目名,如:/jquery
var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
return (localhostPaht + projectName);
}
var treeGrid;
$(function(){
InitTreeGrid();
});
/**
* 初始化treegrid
*/
function InitTreeGrid(){
treeGrid = $('#treeGrid').treegrid({
url: getRootPath() + '/treeGrid',
title: '编辑treeGrid',
rownumbers: true,
idField: 'id',
treeField: 'text',
width: '100%',
fitColumns: true,
columns: [[{
title: '序号',
field: 'id',
align: 'center',
//复选框
checkbox: true
}, {
title: '名称',
field: 'text',
width: 280
}, {
title: '全名',
field: 'fullname',
width: 280,
align: 'right'
}, {
title: '英文名',
field: 'nameen',
width: 280
}, {
title: '级别',
field: 'level',
width: 280
}, {
title: '状态',
field: 'status',
width: 280
}]],
toolbar: [{
id: 'idAdd',
text: '增加',
iconCls: 'icon-add',
plain: 'true',
//按钮事件
handler: function(){
}
}, '-', {
id: 'idDelete',
text: '删除',
//disabled: true,
iconCls: 'icon-remove',
//按钮事件
handler: function(){
}
}, '-', {
id: 'idEdit',
text: '修改',
iconCls: 'icon-edit',
//disabled: true,
handler: function(){
}
}, '-', {
id: 'idSave',
text: '保存',
iconCls: 'icon-save',
//disabled: true,
handler: function(){
}
}, '-', {
id: 'idCancle',
text: '取消编辑',
iconCls: 'icon-undo',
//disabled: true,
handler: function(){
}
}, '-'],
});
}
/**
* 修改树
*/
function modifyTree(){
}
/**
* 删除节点
*/
function removeTree(){
//获取选中的行数
var rows = treeGrid.treegrid('getSelections');
if (rows.length > 0) {
//存放选中行的id
var ids = [];
for (var i = 0; i < rows.length; i++) {
ids.push(rows[i].oid);
}
}
}
点击复选框时只能单选,不知道什么问题,求大侠们指教
源码
//设置treegrid自适应
$(window).resize(function(){
$('#treeGrid').treegrid('resize', {
width: '100%'
})
});
//js获取项目根路径,如: http://localhost:8088/jquery
function getRootPath(){
//获取当前网址,如: http://localhost:8088/jquery/easyui/login.jsp
var curWwwPath = window.document.location.href;
//获取主机地址之后的目录,如: jquery/easyui/login.jsp
var pathName = window.document.location.pathname;
var pos = curWwwPath.indexOf(pathName);
//获取主机地址,如: http://localhost:8088
var localhostPaht = curWwwPath.substring(0, pos);
//获取带"/"的项目名,如:/jquery
var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
return (localhostPaht + projectName);
}
var treeGrid;
$(function(){
InitTreeGrid();
});
/**
* 初始化treegrid
*/
function InitTreeGrid(){
treeGrid = $('#treeGrid').treegrid({
url: getRootPath() + '/treeGrid',
title: '编辑treeGrid',
rownumbers: true,
idField: 'id',
treeField: 'text',
width: '100%',
fitColumns: true,
columns: [[{
title: '序号',
field: 'id',
align: 'center',
//复选框
checkbox: true
}, {
title: '名称',
field: 'text',
width: 280
}, {
title: '全名',
field: 'fullname',
width: 280,
align: 'right'
}, {
title: '英文名',
field: 'nameen',
width: 280
}, {
title: '级别',
field: 'level',
width: 280
}, {
title: '状态',
field: 'status',
width: 280
}]],
toolbar: [{
id: 'idAdd',
text: '增加',
iconCls: 'icon-add',
plain: 'true',
//按钮事件
handler: function(){
}
}, '-', {
id: 'idDelete',
text: '删除',
//disabled: true,
iconCls: 'icon-remove',
//按钮事件
handler: function(){
}
}, '-', {
id: 'idEdit',
text: '修改',
iconCls: 'icon-edit',
//disabled: true,
handler: function(){
}
}, '-', {
id: 'idSave',
text: '保存',
iconCls: 'icon-save',
//disabled: true,
handler: function(){
}
}, '-', {
id: 'idCancle',
text: '取消编辑',
iconCls: 'icon-undo',
//disabled: true,
handler: function(){
}
}, '-'],
});
}
/**
* 修改树
*/
function modifyTree(){
}
/**
* 删除节点
*/
function removeTree(){
//获取选中的行数
var rows = treeGrid.treegrid('getSelections');
if (rows.length > 0) {
//存放选中行的id
var ids = [];
for (var i = 0; i < rows.length; i++) {
ids.push(rows[i].oid);
}
}
}