jqgrid 編輯添加功能詳細解析
更新時間:2013年11月08日 10:10:35 作者:
本文是對jqgrid 編輯添加功能進行了詳細的介紹,需要的朋友可以過來參考下,希望對大家有所幫助
ColModel 是jqGrid里最重要的一個屬性,設置表格列的屬性。
用法:
Java代碼 :
復制代碼 代碼如下:
jQuery("#gridid").jqGrid({
...
colModel: [ {name:'name1', index:'index1'...}, {...}, ... ],
..
});
屬性 數(shù)據(jù)類型 備注 默認值
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 可以編輯的類型??蛇x值:text, textarea, select, checkbox, password, button, image and file. text
fixed boolean 列寬度是否要固定不可變 false
formoptions array 對于form進行編輯時的屬性設置 empty
formatoptions array 對某些列進行格式化的設置 none
formatter mixed 對列進行格式化時設置的函數(shù)名或者類型 none
hidedlg boolean 是否顯示或者隱藏此列 false
hidden boolean 在初始化表格時是否要隱藏此列 false
index string 當排序時定義排序字段名稱的索引,參數(shù)名為sidx empty string
jsonmap string 定義了返回的json數(shù)據(jù)映射 none
key boolean 當從服務器端返回的數(shù)據(jù)中沒有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 設置搜索參數(shù) empty
sortable boolean 是否可排序 true
sorttype string 用在當datatype為local時,定義搜索列的類型,可選值:int/integer - 對integer排序float/number/currency - 排序數(shù)字date - 排序日期text - 排序文本 text
stype string 定義搜索元素的類型 text
surl string 搜索數(shù)據(jù)時的url empty string
width number 默認列的寬度,只能是象素值,不能是百分比 150
xmlmap string 定義當前列跟返回的xml數(shù)據(jù)之間的映射關系 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 不包含
相關文章
JQuery EasyUI 結合ztrIee的后臺頁面開發(fā)實例
下面小編就為大家?guī)硪黄狫Query EasyUI 結合ztrIee的后臺頁面開發(fā)實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-09-09
jQuery EasyUI API 中文文檔 - ValidateBox驗證框
jQuery EasyUI API 中文文檔 - ValidateBox驗證框,使用jQuery EasyUI的朋友可以參考下。2011-10-10

