点击复选框时只能单选,不知道什么问题,求大侠们指教
源码
//设置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数据量过大的时候 使用 $('#tg').treegrid('collapseAll'); 和 $('#tg').treegrid('expandAll');会造成严重卡顿, 解决方案: 数据增加属性 state:closed, 即可默认收起,反之展开,需再展开时,将加载...
jquery easyui treegrid demo 详解 增删改查 用IE打开,并选择允许
编写js方法,将一般的json格式数据转为easyui treegrid使用的json格式 ............
jquery easyui treegrid 拖拽demo
所有层关键源代码,附图于附件没有任何问题 最关键的是json table 拼接为前台需要的格式,显示列动态以逗号分开
主要介绍了Jquery EasyUI实现treegrid上显示checkbox并取选定值的方法的相关资料,需要的朋友可以参考下
通关类型判断显示包库/还是镜像(列有所不同,镜像共4列),勾选一个复选框,后面的复选框变为不可勾选状态。 下面是具体代码: 1,初始化treegrid,(其中有几个type列,是由后台人员提供的字段名,虽然我也不想弄...
主要介绍了jQuery EasyUI的TreeGrid查询功能实现方法,需要的朋友可以参考下
easyui treegrid 优化,包括 以新背景色标识鼠标所指行
SSH+Easyui之TreeGrid树形展现数据源码
本代码在EasyUI官网原treegrid拖放demo的基础上进行详尽的注释,并加以改动,如今可以实现两个treegrid之间互相拖放,本代码分别可以进行“剪切”和“复制”的功能,当前使用的是“剪切”功能,可通过改变treegrid-...
//这里使用的easyui1.3.6 //解决的问题是Tree控件的checkbox不能设置为不允许用户勾选 //设置一个标志位,在整棵树加载完成后就将标志位设置为false,不允许勾选checkbox了,在加载数据完成之前是可以勾选的,用来在...
在DataGrid中进行复选框的操作(全选和取消)
主要介绍了Easyui Treegrid改变默认图标的方法的相关资料,需要的朋友可以参考下
最近涉及到treegrid组件的查询,需要根据查询条件动态更新EasyUI的treegrid组件的动态加载查询结果
easyui treegrid 冻结右侧列插件
在官网上下了个treegrid-dnd.js实现拖拽,发现并没有太多条件限制,自己修改了一下,限制只能拖拽到比自己高一级别的父节点中,希望大家有用
NULL 博文链接:https://zhglhy.iteye.com/blog/1766581