grid.js php 用法,JavaScript_jqgrid 编辑添加功能详细解析,ColModel 是jqGrid里最重要的一个 - phpStudy...

jqgrid 编辑添加功能详细解析

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, checkbox, password, button, image and file.  text

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

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

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

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

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

源码中添加

editurl:'index.php?do=do_edit',

addurl:'index.php?do=do_add',

datatype: 'xml',

mtype: 'GET',

colNames:['ID', '任务名称', '所属类'

colModel :[

{name:'taskid', index:'taskid', width:100,align:'center',searchoptions:{sopt:['eq','ne','lt','le','gt','ge']}},

{name:'taskname', index:'taskname', width:100, align:'center',editable:true},

{name:'classid', index:'classid', width:100, align:'center',editable:true,edittype:'select',editoptions: {

value: '1:事务;2:非事务'},editselected:'classid'},

],

添加editable后 添加也是同样有效的;

搜索eq 等于( = )

ne 不等于( <> )

lt 小于( < )

le 小于等于( <= )

gt 大于( > )

ge 大于等于( >= )

bw 开始于 ( LIKE val% )

bn 不开始于 ( not like val%)

in 在内 ( in ())

ni 不在内( not in ())

ew 结束于 (LIKE %val )

en 不结束于

cn 包含 (LIKE %val% )

nc 不包含相关阅读:

Java读取图片EXIF信息的方法

Android仿微信实现首字母导航条

ListView异步加载图片实现思路(优化篇)

JSP和JSTL获取服务器参数示例

PHP面试常用算法(推荐)

SQLite 入门教程一 基本控制台(终端)命令

CentOS下使用Fail2ban来禁止指定IP访问的方法

jQuery实现的鼠标经过时变宽的效果(附demo源码)

PHP自定义函数获取搜索引擎来源关键字的方法

php中sprintf与printf函数用法区别解析

Win8.1系统如何使用IE跟踪保护功能去除网页广告 使用IE跟踪保护功能屏蔽网页广告的设

轻松创建nodejs服务器(2):nodejs服务器的构成分析

win10电源里没有快速启动这个功能怎么办

一款简单的jQuery图片标注效果附源码下载

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值