easyui中treegrid复选框不能复选的问题

风行傲天 风行傲天 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区


点击复选框时只能单选,不知道什么问题,求大侠们指教

源码

//设置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);
}
}
}
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
风行傲天
JavaScript 87,984 成员 224,680 内容