您好,欢迎来到飒榕旅游知识分享网。
搜索
您的当前位置:首页jQueryjqGrid中ColModel的参数大全(详解带实例)(精)

jQueryjqGrid中ColModel的参数大全(详解带实例)(精)

来源:飒榕旅游知识分享网


jQuery jqGrid中 ColModel 的参数大全(详解带实例 (2012-03-28 10:53:46转载▼

标签: jquery jqgrid colmodel的参数 大全 详解 demo 实例 杂谈 分类: WEB技术

ColModel 是 jqGrid 里最重要的一个属性,设置表格列的属性。

用法:

Java 代码

jQuery(\"#gridid\".jqGrid({

...

colModel: [ {name:'name1', index:'index1'...}, {...}, ... ],

...

};

属性 数据类型 备注 默认值

align string 定义单元格对齐方式;可选值:left, center, right. left

classes string 设置列的 css 。 多个 class 之间用空格分隔, 如:'class1 class2' 。 表格默认的 css 属性是 ui-ellipsis empty string

datefmt string 对日期列进行格式化。 ” /” , ” -” , and ” . ” 都是有效的日期分隔符。 y,Y,yyyy 年 YY, yy 月 m,mm for monthsd,dd 日 . ISO Date (Y-m-d

defval string 查询字段的默认值 空

editable boolean 单元格是否可编辑 false

editoptions array 对列进行编辑时设置的一些属性 empty array

editrules array 对于可编辑单元格的一些额外属性设置 empty array

edittype string 可以编辑的类型。 可选值:text, textarea, select, password, button, image and file. text

fixed boolean 列宽度是否要固定不可变 false

formoptions array 对于 form 进行编辑时的属性设置 empty

formatoptions array 对某些列进行格式化的设置 none

formatter mixed 对列进行格式化时设置的函数名或者类型 none

checkbox,

hidedlg boolean 是否显示或者隐藏此列 false

hidden boolean 在初始化表格时是否要隐藏此列 false

index string 当排序时定义排序字段名称的索引,参数名为 sidx empty string

jsonmap string 定义了返回的 json 数据映射 none

key boolean 当从服务器端返回的数据中没有 id 时,将此作为唯一 rowid 使用,默认只 能有一个 id 属性 false

label string 如果 colNames 为空则用此值来作为列的显示名称,如果都没有设置则使用 name 值 none

name string 必输项, 表格列的名称, 所有关键字, 保留字都不能作为名称使用包括 subgrid, cb and rn. Required

resizable boolean 是否可以被 resizable true

search boolean 在搜索模式下,定义此列是否可以作为搜索列 true

searchoptions array 设置搜索参数 empty

sortable boolean 是否可排序 true

sorttype string 用在当 datatype 为 local 时,定义搜索列的类型,可选值:int/integer - 对 integer 排序 float/number/currency - 排序数字 date - 排序日期 text - 排序文本 text stype string 定义搜索元素的类型 text

surl string 搜索数据时的 url empty string

width number 默认列的宽度,只能是象素值,不能是百分比 150

xmlmap string 定义当前列跟返回的 xml 数据之间的映射关系 none

unformat function ‘ unformat ’ 单元格值 null

有一些参数当表格初始化完成后是不能被修改的:

name

width

resizable

label (method avail.

例子:

$(\"#grid1\".xgrid({

url:{url:'../data/json-grid-standard.htm',pageSize:'10',currentPage:'1'},// 列表数 据

colModel:[{\"display\":\"序号

\

{\"display\":\"登陆

ID\

{\"display\":\"姓名 \{\"display\":\"组织机构

\

{\"display\":\"区域

\

{\"display\":\"日期

\

{\"display\":\"是否删除

\

], //列表结构配置

title:'列表控件 ',

searchitems:[

{\"display\":\"登陆 ID\

{\"display\":\"姓名 \

{\"display\":\"时间 \

{\"display\":\"日期 \

{\"display\":\"区域代码 \

],//列表中搜索的条件项

width:800,

callback:function({ alert('列表初始化完成后,执行回调 ' },

searchMode:true //搜索模式,初始化时不加载数据并隐藏列表

};

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- sarr.cn 版权所有 赣ICP备2024042794号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务