`
conanca
  • 浏览: 98666 次
  • 性别: Icon_minigender_1
  • 来自: 青岛
社区版块
存档分类
最新评论

jqGrid基础学习:4jqGrid的ColModel API

阅读更多

ColModel是jqGrid里面最核心的属性。大部分配置都在这里面进行。所有的属性的含义对应如下:

 

Property Type Description Default
align string Defines the alignment of the cell in the Body layer, not in header cell. Possible values: left, center, right.
定义单元格对齐方式;可选值:left, center, right。例如:

{name:’id’,align:’left’},实现左对齐。

left
classes string This option allow to add classes to the column. If more than one class will be used a space should be set. By example classes:’class1 class2′ will set a class1 and class2 to every cell on that column. In the grid css there is a predefined class ui-ellipsis which allow to attach ellipsis to a particular row. Also this will work in FireFox too.
置列的css。多个class之间用空格分隔,如:’class1 class2′ 。表格默认的css属性是ui-ellipsis。这个属性在火狐浏览器中也是有效的。
empty string
datefmt string Governs format of sorttype:date (when datetype is set to local) and editrules {date:true} fields. Determines the expected date format for that column. Uses a PHP -like date formatting. Currently ”/”, ”-”, and ”.” are supported as date separators. Valid formats are:
y,Y,yyyy for four digits year
YY, yy for two digits year
m,mm for months
d,dd for days.
当sorttype为date和编辑规则的date为true是有效。使用的格式和php一样。默认为Y-m-d
ISO Date (Y-m-d)
defval string The default value for the search field. This option is used only in Custom Searching and will be set as initial search.
查询字段的默认值。这个选项只在自定义所属中有效。
empty
editable boolean Defines if the field is editable. This option is used in cell, inline and form modules.
设定是否可以对单元格进行编辑{name:’id’,index:’id’, width:180,editable:true},
false
editoptions array Array of allowed options (attributes) for edittype option editing
编辑的一系列选项。{name:’__department_id’,index:’__department_id’,width:200,editable:true,edittype:’select’,editoptions: {dataUrl:”${ctx}/admin/deplistforstu.action”}},这个是演示动态从服务器端获取数据。
empty array
editrules array sets additional rules for the editable field editing
编辑的规则{name:’age’,index:’age’, width:90,editable:true,editrules: {edithidden:true,required:true,number:true,minValue:10,maxValue:100}},设定 年龄的最大值为100,最小值为10,而且为数字类型,并且为必输字段。
empty array
edittype string Defines the edit type for inline and form editing Possible values: text, textarea, select, checkbox, password, button, image and file.
编辑的类型,可为text、textarea,select、checkbox、password、button、image、file等。
text
fixed boolean If set to true this option does not allow recalculation of the width of the column if shrinkToFit option is set to true. Also the width does not change if a setGridWidth method is used to change the grid width.
如果设定为true的话,单元格的大小将无法进行调整(即不可更改其宽度),同样,调用setGridWidth的方法也不会改变其大小。
false
formoptions array Defines various options for form editing.
form编辑的一些选项
empty
formatoptions array Format options can be defined for particular columns, overwriting the defaults from the language file. See Formatter for more details.
对某些列进行格式化的设置
none
formatter mixed The predefined types (string) or custom function name that controls the format of this field.
对列进行格式化时设置的函数名或者类型

{name:’sex’,index:’sex’, align:’center’,width:60,editable:true,edittype:’select’,editoptions: {value:’0:待定;1:男;2:女’},formatter:function(cellvalue, options, rowObject){
             var temp = “<img src=’${ctx}/jquery-ui-1.7.2.custom/css/img/”
             if(cellvalue==1){
              temp = temp +”user-white.png”;
             } else if(cellvalue==2){
              temp = temp +”user-white-female.png”;
             } else {
              temp = temp + “user-silhouette.png”;
             }
             temp = temp + “‘ border=’0′ />”
             return temp;
            }},//返回性别的图标。

none
hidedlg boolean If set to true this column will not appear in the modal dialog where users can choose which columns to show or hide.
如果设置为true将显示在对话框中,可以让用户选择该列是显示或隐藏。
false
hidden boolean Defines if this column is hidden at initialization.
定义在初始化的时候是否隐藏此列
false
index string Set the index name when sorting. Passed as sidx parameter.
索引。其和后台交互的参数为sidx
empty string
jsonmap string Defines the json mapping for the column in the incoming json string.
定义返回的json的映射。
none
key boolean In case if there is no id from server, this can be set as as id for the unique row id. Only one column can have this property. If there are more than one key the grid finds the first one and the second is ignored.
如果从服务器返回的数据没有id属性,那么此列将被作为唯一的属性而设置为id,只有一个列可以做这项设置。如果设置多于一个,那么只选取第一个,其他被忽略。
false
label string When colNames array is empty, defines the heading for this column. If both the colNames array and this setting are empty, the heading for this column comes from the name property.
如果colNames为空则用此值来作为列的显示名称,如果都没有设置则使用name 值
none
name string Set the unique name in the grid for the column. This property is required. As well as other words used as property/event names, the reserved words (which cannot be used for names) include subgrid, cb and rn.
必输项,表格列的名称,所有关键字,保留字都不能作为名称使用包括subgrid, cb and rn.
Required
resizable boolean Defines if the column can be re sized
是否可以改变大小(主要是宽)
true
search boolean When used in search modules, disables or enables searching on that column.
在搜索模式下,定义此列是否可以作为搜索列
true
searchoptions array Defines the search options used searching
设定搜索的选项。
empty
sortable boolean Defines is this can be sorted.
定义是否可以排序
true
sorttype string Used when datatype is local. Defines the type of the column for appropriate sorting.Possible values:
int/integer – for sorting integer
float/number/currency – for sorting decimal numbers
date – for sorting date
text – for text sorting
用在当datatype为local时,定义搜索列的类型,可选值:int/integer – 对integer排序float/number/currency – 排序数字date – 排序日期text – 排序文本
text
stype string Determines the type of the element when searching.
定义搜索元素的类型
text
surl string Valid only in Custom Searching and edittype : ‘select’ and describes the url from where we can get already-constructed select element
搜索的地址。只在自定义搜索和editype为select的时候有效。
empty string
width number Set the initial width of the column, in pixels. This value currently can not be set as percentage
在初始化的宽度,这个值不可以使用百分比的格式。初始化为150pixels。

{name:’id’,index:’id’, width:180,editable:true,editoptions:{readonly:true,size:10}}

150
xmlmap string Defines the xml mapping for the column in the incomming xml file. none
unformat function Custom function to “unformat” a value of the cell when used in editing Unformat is also called during sort operations. The value returned by unformat is the value compared during the sort.)
和format对应。
分享到:
评论

相关推荐

    jqGrid手册教程一本通

    jqGrid 学习 ColModel API 55 jqGrid 学习 参数(2) 57 jqGrid 学习 jqGrid 参数 63 jqGrid 学习 第一个实例 63 使用 jqGrid 修改数据并检查 69"&gt;jqGrid 学习 原理 2 jqGrid 学习之 皮肤 2 jqGrid [更多]

    jqgrid colModel中文配置文档

    这份文档主要描述的是jqgrid中colModel的属性配置!

    jqgrid 二次封装上传 jqgrid 5.0以上版本

    jqgrid二次封装,快速加载grid表格,不改变原有的使用习惯,增加一些默认处理逻辑 var grid = $.jqGrid.init({ url: "&lt;%=basePath%&gt;/component/config/select.html", add: {content:"&lt;%=basePath%&gt;/admin/...

    jqGrid 做的表格分页

    colModel:[ {name:'id',index:'id', width:60, sorttype:"int"}, {name:'time',index:'time', width:90, sorttype:"date"}, {name:'name',index:'name', width:100}, {name:'title',index:'title', width:300, ...

    jqGrid Wiki部分文档说明

    wiki_options - jqGrid Wiki wiki_colmodel_options - jqGrid Wiki wiki_methods - jqGrid Wiki wiki_events - jqGrid Wiki 4个pdf文件

    jqgrid Tree

    link rel="stylesheet" type="text/css" media="screen" href="jqgrid/ui.jqgridffe4.css" /&gt; &lt;style&gt; html, body { margin: 0; padding: 0; font-size: 75%; } &lt;/style&gt; [removed]...

    jqGrid 离线帮助手册

    jqGrid 最新版 3.7.2 离线帮助手册,方便各位查看 Installing jqGrid Before you begin System Requirements Download jqGrid Change Log How to Install How it Works My First Grid Basic Grid Conventions ...

    jqGrid 离线帮助手册 来源官方wiki

    jqGrid 3.7.2 版本 官方完整帮助手册,含有很多代码样例,方便大家查看学习。 Upgrading Upgrade from 3.6.4 to 3.6.5 Upgrade from 3.4.x to 3.5 Installing jqGrid Before you begin System Requirements Download...

    jqGrid_各种参数_详解

    jqGrid_各种参数_详解

    PHP jqGrid 数据网格显示并分页

    jqGrid 是一个用来显示网格数据的jQuery插件,文档比较全面,附带中文版本。 主要特点: -Full control with JavaScript API -Data returned from the server is XML -Simple configuration -Ability to load big ...

    Jquery 实现列的拖动 jquery grid

    jquey 实现grid 的列的自由拖动 和内容的自由展示和压缩 类似于excel效果。

    jquery.jqGrid-4.4.1

    jqGrid 4.4.1 New search module, Tree Grid and SubGrid improvements, new colModel cellattr event and much more... Enjoy

    jQGrid Table操作列中点击【操作】按钮弹出按钮层的实现代码

    在使用JqGrid时,Table中最后一列是操作列,在操作列中每一行都一个操作按钮,该操作按钮类似下拉菜单,如下图: 在点击Table中【操作】一列时需要弹出一个Div层,该Div层中包含一堆按钮,用于对Table行进行操作,...

    jqgrid 编辑添加功能详细解析

    ColModel 是jqGrid里最重要的一个属性,设置表格列的属性。 用法: Java代码 : 代码如下:jQuery(“#gridid”).jqGrid({ … colModel: [ {name:’name1′, index:’index1’…}, {…}, … ], .. }); 属性 ...

    Jqgrid设置全选(选择)及获取选择行的值示例代码

    1.添加multiselect: true 2.获取选择行的值 代码如下:var rowData = jQuery(‘#List’).jqGrid(‘getGridParam’,’selarrrow’); if(rowData.length) { for...//name是colModel中的一属性 alert&#40;name&#41;; 

    jqgrid 3.6.2 中文文档

    3页word文档,主要对colModel属性和其他重要属性配置详解.

Global site tag (gtag.js) - Google Analytics