jQuery表格插件:jqGrid
名称 类型 描述
url string 获取数据的地址
datatype string 从服务器端返回的数据类型,默认xml。
可选:xml,local,json,jsonnp,script,xmlstring
mtype string ajax提交方式POST或GET 默认GET 查询多用GET
colNames Array 列显示名称
colModel Array label,name,index,width,align,sortable
rowNum int 每页显示多少条记录
rowList Array 选择条数
viewrecords boolean 定义是否要显示总记录数
caption string 表格名称
cellEdit boolean 启用或者禁用单元格编辑功能
cellurl string 单元格提交的url
editurl string 定义对form编辑时的url
gridstate string 定义当前表格的状态:visible hidden
height mixed 表格高度 默认:150
hiddengrid boolean 当为true时,表格不会被显示,只显示表格的标题,
只有当点击显示表格的按钮才会初始化表格数据
hidegrid boolean 启用或者禁用控制表格显示,隐藏的按钮
jsonReader array 描述json数据格式的数组
loadonce boolean 如果为true,则数据只从服务器端抓取一次
multiselect boolean 定义是否可以多选
multiboxonly boolean 只有选择checkbox才会起作用
multikey String 定义使用哪个key开做多选,shiftkey,altkey,ctrlkey
page integer 设置初始的页码
pgbuttons boolean 是否显示翻页按钮
pginput boolean 是否显示跳转页面的输入框
pgtext string 当前页面信息
postData array 此数组内容直接赋值到url上,参数类型:{k:v}
records integer 定义了返回的记录数
recordtext String 显示记录信息,{0}为记录数开始,{1}为记录数结束,viewrecords为true时才能奇效
rownumbers boolean 如果为true则会在表格左侧新增一列,显示行序列号,名为:rn从1开始递增
scroll boolean 创建一个动态滚动的表格,当为true时,翻页栏被禁用,使用垂直滚动条加载数据,
且在首次访问服务器端时将加载所有数据到客户端。
当此参数为数字时,表格只控制可见的几行,所有数据都在这几行中加载
scrolloffset integer 设置垂直滚动条宽度 默认:18
scrollrows boolean 当为true时让选择的行可见
shrinkToFit boolean 此属性用来说明当初始化列宽度时候的计算类型,如果为ture,则按比例初始化列宽度。
如果为false,则列宽度使用colModel指定的宽度
sortable boolean 是否可排序
sortname string 排序列的名称
sortorder string asc desc
subGrid boolean 是否使用子表格
subGridModel array
subGridType mixed 如果为空则使用表格的dataType
subGridUrl string 加载subgrid数据的url,jqGrid会把每行的id值加到url中
subGridWidth integer subGrid列的宽度
treedatatype mixed 数据类型
treeGrid boolean 启用或者禁用treegrid模式
treeGridModel string treeGrid所使用的方法
userData array 从request中取得一些用户信息
ColModel API
align string left,center,right
editable boolean 单元格是否可以编辑
editoptions array 编辑的一系列选项
edittype stirng 'text', 'textarea', 'select', 'checkbox', 'password', 'button', 'image', 'file'以及'custom'。默认值是text。
editrules array 编辑的规则{edithidden:true,required:true,number:true}
formoptiions array 对于form进行编辑时的属性设置
formatoptions array 对某些咧进行格式化的设置
formatter mixed 对列进行格式化时设置的函数名或者类型
hidedlg boolean 是否显示或者隐藏此列
jsonmap string 定义了返回的json数据映射
label string 列的显示名称
name string 表格列的名称
resizable boolean 是否可以被resizable
search boolean 在搜索模式下,定义此列是否可以作为搜索列
searchoptions array 设置搜索参数
sortable boolean 是否可排序
sorttype string int/integer,float/number/currency date text
stype string 定义搜索元素的类型
surl string 搜索数据时的url
searchoptions 参数
dataInit function 通常用在日期选择上
sopt array 此参数只用到单列搜索上,说明搜索条件。
可用值:['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'
意思为:['equal','not equal', 'less', 'less or equal','greater','greater or equal',
'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain']
value mixed 只用在搜索类型为select下。可以是string或者object,如果为string则格式为value:label,
且以“;”结尾;如果为object格式为editoptions:{value:{1:'One';2:'Two'}}
afterComplete: 当所有动作和事件执行完毕,数据行已经添加或者更新到grid后触发
function(response,postdata,formid){
response:服务器返回的数据(ajax对象,注意不是ajaxobj.responseText)
postdata:提交到服务器的数据
formid:jquery包装好的对象,通过formid[0].id获取表单id值
}
afterSubmit: 提交数据从服务器返回后chufa,主要显示数据保存成功或者保存失败的原因
afterSubmit(response,postdata){
return[boolean,message,new_id]
当为true时,将会弹出一个对话框显示的错误信息,message的值
}
名称 类型 描述
url string 获取数据的地址
datatype string 从服务器端返回的数据类型,默认xml。
可选:xml,local,json,jsonnp,script,xmlstring
mtype string ajax提交方式POST或GET 默认GET 查询多用GET
colNames Array 列显示名称
colModel Array label,name,index,width,align,sortable
rowNum int 每页显示多少条记录
rowList Array 选择条数
viewrecords boolean 定义是否要显示总记录数
caption string 表格名称
cellEdit boolean 启用或者禁用单元格编辑功能
cellurl string 单元格提交的url
editurl string 定义对form编辑时的url
gridstate string 定义当前表格的状态:visible hidden
height mixed 表格高度 默认:150
hiddengrid boolean 当为true时,表格不会被显示,只显示表格的标题,
只有当点击显示表格的按钮才会初始化表格数据
hidegrid boolean 启用或者禁用控制表格显示,隐藏的按钮
jsonReader array 描述json数据格式的数组
loadonce boolean 如果为true,则数据只从服务器端抓取一次
multiselect boolean 定义是否可以多选
multiboxonly boolean 只有选择checkbox才会起作用
multikey String 定义使用哪个key开做多选,shiftkey,altkey,ctrlkey
page integer 设置初始的页码
pgbuttons boolean 是否显示翻页按钮
pginput boolean 是否显示跳转页面的输入框
pgtext string 当前页面信息
postData array 此数组内容直接赋值到url上,参数类型:{k:v}
records integer 定义了返回的记录数
recordtext String 显示记录信息,{0}为记录数开始,{1}为记录数结束,viewrecords为true时才能奇效
rownumbers boolean 如果为true则会在表格左侧新增一列,显示行序列号,名为:rn从1开始递增
scroll boolean 创建一个动态滚动的表格,当为true时,翻页栏被禁用,使用垂直滚动条加载数据,
且在首次访问服务器端时将加载所有数据到客户端。
当此参数为数字时,表格只控制可见的几行,所有数据都在这几行中加载
scrolloffset integer 设置垂直滚动条宽度 默认:18
scrollrows boolean 当为true时让选择的行可见
shrinkToFit boolean 此属性用来说明当初始化列宽度时候的计算类型,如果为ture,则按比例初始化列宽度。
如果为false,则列宽度使用colModel指定的宽度
sortable boolean 是否可排序
sortname string 排序列的名称
sortorder string asc desc
subGrid boolean 是否使用子表格
subGridModel array
subGridType mixed 如果为空则使用表格的dataType
subGridUrl string 加载subgrid数据的url,jqGrid会把每行的id值加到url中
subGridWidth integer subGrid列的宽度
treedatatype mixed 数据类型
treeGrid boolean 启用或者禁用treegrid模式
treeGridModel string treeGrid所使用的方法
userData array 从request中取得一些用户信息
ColModel API
align string left,center,right
editable boolean 单元格是否可以编辑
editoptions array 编辑的一系列选项
edittype stirng 'text', 'textarea', 'select', 'checkbox', 'password', 'button', 'image', 'file'以及'custom'。默认值是text。
editrules array 编辑的规则{edithidden:true,required:true,number:true}
formoptiions array 对于form进行编辑时的属性设置
formatoptions array 对某些咧进行格式化的设置
formatter mixed 对列进行格式化时设置的函数名或者类型
hidedlg boolean 是否显示或者隐藏此列
jsonmap string 定义了返回的json数据映射
label string 列的显示名称
name string 表格列的名称
resizable boolean 是否可以被resizable
search boolean 在搜索模式下,定义此列是否可以作为搜索列
searchoptions array 设置搜索参数
sortable boolean 是否可排序
sorttype string int/integer,float/number/currency date text
stype string 定义搜索元素的类型
surl string 搜索数据时的url
searchoptions 参数
dataInit function 通常用在日期选择上
sopt array 此参数只用到单列搜索上,说明搜索条件。
可用值:['eq','ne','lt','le','gt','ge','bw','bn','in','ni','ew','en','cn','nc'
意思为:['equal','not equal', 'less', 'less or equal','greater','greater or equal',
'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain']
value mixed 只用在搜索类型为select下。可以是string或者object,如果为string则格式为value:label,
且以“;”结尾;如果为object格式为editoptions:{value:{1:'One';2:'Two'}}
afterComplete: 当所有动作和事件执行完毕,数据行已经添加或者更新到grid后触发
function(response,postdata,formid){
response:服务器返回的数据(ajax对象,注意不是ajaxobj.responseText)
postdata:提交到服务器的数据
formid:jquery包装好的对象,通过formid[0].id获取表单id值
}
afterSubmit: 提交数据从服务器返回后chufa,主要显示数据保存成功或者保存失败的原因
afterSubmit(response,postdata){
return[boolean,message,new_id]
当为true时,将会弹出一个对话框显示的错误信息,message的值
}