码迷,mamicode.com
首页 > 其他好文 > 详细

ligerui_grid使用方法

时间:2015-02-03 16:50:58      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:

function f_initGrid()
        {
             g = manager = $("#maingrid").ligerGrid({
              columns:[
              { display: ‘主键‘, name: ‘ID‘,width: 50,type: ‘int‘},
              { display: ‘名字‘, name: ‘RealName‘,editor:{type:‘text‘}},   //editor  编辑器 (可配合detailToEdit使用)
                { display: ‘性别‘, width: 50, name: ‘Sex‘,type:‘int‘,
                    editor: { type: ‘select‘, data: sexData, valueColumnName: ‘Sex‘ },  //valueColumnName  编辑器下拉框的默认值
                     render: function (item)
                     {
                         if (parseInt(item.Sex) == 1) return ‘男‘;
                         return ‘女‘;
                     }
                },
                    { display: ‘入职日期‘, name: ‘IncomeDay‘, type: ‘date‘, format: ‘yyyy年MM月dd日‘, width: 100, editor: { type: ‘date‘}
                    },
                 { display: ‘部门‘, name: ‘DepartmentID‘, width: 120, isSort: false,   //isSort  是否允许排序
                                //valueColumnName  对应表格的属性名   displayColumnName  也是对应表格的属性名
                     editor: { type: ‘select‘, data: DepartmentList, valueColumnName: ‘DepartmentID‘, displayColumnName: ‘DepartmentName‘ },
                     render: function (item)
                     {
                         for (var i = 0; i < DepartmentList.length; i++)
                         {
                             if (DepartmentList[i][‘DepartmentID‘] == item.DepartmentID)
                                 return DepartmentList[i][‘DepartmentName‘]
                         }
                         return item.DepartmentName;
                     }
                },

        //editor 编辑方式文本域属性
                 { display: ‘地址‘, name: ‘Address‘,
                     editor: { type: ‘textarea‘,height:60,width:600 }, align: ‘left‘, width: 300
                 } 
              ],
              onSelectRow:function (rowdata,rowindex){
               //alert("onSelectRow!"+rowdata.ID+"------>"+rowindex);
              },
              //enabledEdit:true 是否允许编辑  detailToEdit:true是否启用明细编辑模式
              //isScroll:false  其否启动滚动条   frozen:false是否启动固定列
              //data:EmployeeData,数据源  json格式
              //onBeforeSubmitEdit:f1   编辑器验证
              enabledEdit:true,detailToEdit:true,
              isScroll:false,frozen:false,
              data:EmployeeData,
              width:‘100%‘
             });
           
        }

ligerui_grid使用方法

标签:

原文地址:http://www.cnblogs.com/sunflo/p/4270314.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!