`
Supanccy2013
  • 浏览: 215787 次
  • 性别: 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(){
            
            }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics