`
Supanccy2013
  • 浏览: 227906 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

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(){
            
            }
分享到:
评论

相关推荐

    Jquery EasyUI实现treegrid上显示checkbox并取选定值的方法

    在TreeGrid中添加复选框(checkbox)可以方便用户进行多项选择,比如批量删除、选中等操作。 实现TreeGrid上显示checkbox并取选定值的基本思路是利用formatter自定义渲染单元格,在特定的列中插入checkbox,并在...

    jQuery Easyui Treegrid实现显示checkbox功能

    首先,要实现 Treegrid 中的复选框功能,我们需要在列定义(columns)中增加一个字段,该字段将用于显示复选框。例如,我们可以创建一个名为 `IsChecked` 的隐藏字段,用于存储每个节点的选中状态。在初始化 ...

    jquery easyui中treegrid用法的简单实例

    在 `title_formatter` 函数中,我们实现了为每一行的 `title` 列添加一个复选框。这里使用了 `access_node` 变量,将其值分割成数组,然后在创建复选框时设置其值。`set_power_status` 函数则是当用户点击复选框时...

    EasyUI tutorial 中文版 chm

    easyUI 创建Tree和复选框Tree Node easyUI 拖动(Drag)和放置(Drop)Tree easyUI 加载parent/child节点到tree 转换tree标准格式数据 easyUI 创建一个基础的TreeGrid easyUI 创建复杂TreeGrid Form easyUI ...

    treegrid check

    有许多开源的JavaScript库,如jQuery UI、EasyUI、zTree等,都提供了TreeGrid功能,并且可以方便地添加复选框。以jQuery UI为例,它的TreeGrid可以通过插件实现,而zTree则内置了复选框支持。 在实现这一功能时,...

    JEECG UI标签库帮助文档v3.3

    | checkbox | boolean | 是否包含复选框 | 否 | false | **2.3. Operate(操作)子标签** - **2.3.1. 删除操作标签** ``` 删除" iconCls="icon-remove" confirmMsg="确定要删除吗?" operation="delete"> ``` ...

Global site tag (gtag.js) - Google Analytics