jqgrid 編輯添加功能詳細(xì)解析
ColModel 是jqGrid里最重要的一個(gè)屬性,設(shè)置表格列的屬性。
用法:
Java代碼 :
jQuery("#gridid").jqGrid({
...
colModel: [ {name:'name1', index:'index1'...}, {...}, ... ],
..
});
屬性 數(shù)據(jù)類型 備注 默認(rèn)值
align string 定義單元格對齊方式;可選值:left, center, right. left
classes string 設(shè)置列的css。多個(gè)class之間用空格分隔,如:'class1 class2' 。表格默認(rèn)的css屬性是ui-ellipsis empty string
datefmt string 對日期列進(jìn)行格式化?!?”, ”-”, and ”.”都是有效的日期分隔符。y,Y,yyyy 年YY, yy 月m,mm for monthsd,dd 日. ISO Date (Y-m-d)
defval string 查詢字段的默認(rèn)值 空
editable boolean 單元格是否可編輯 false
editoptions array 對列進(jìn)行編輯時(shí)設(shè)置的一些屬性 empty array
editrules array 對于可編輯單元格的一些額外屬性設(shè)置 empty array
edittype string 可以編輯的類型。可選值:text, textarea, select, checkbox, password, button, image and file. text
fixed boolean 列寬度是否要固定不可變 false
formoptions array 對于form進(jìn)行編輯時(shí)的屬性設(shè)置 empty
formatoptions array 對某些列進(jìn)行格式化的設(shè)置 none
formatter mixed 對列進(jìn)行格式化時(shí)設(shè)置的函數(shù)名或者類型 none
hidedlg boolean 是否顯示或者隱藏此列 false
hidden boolean 在初始化表格時(shí)是否要隱藏此列 false
index string 當(dāng)排序時(shí)定義排序字段名稱的索引,參數(shù)名為sidx empty string
jsonmap string 定義了返回的json數(shù)據(jù)映射 none
key boolean 當(dāng)從服務(wù)器端返回的數(shù)據(jù)中沒有id時(shí),將此作為唯一rowid使用,默認(rèn)只能有一個(gè)id屬性 false
label string 如果colNames為空則用此值來作為列的顯示名稱,如果都沒有設(shè)置則使用name 值 none
name string 必輸項(xiàng),表格列的名稱,所有關(guān)鍵字,保留字都不能作為名稱使用包括subgrid, cb and rn. Required
resizable boolean 是否可以被resizable true
search boolean 在搜索模式下,定義此列是否可以作為搜索列 true
searchoptions array 設(shè)置搜索參數(shù) empty
sortable boolean 是否可排序 true
sorttype string 用在當(dāng)datatype為local時(shí),定義搜索列的類型,可選值:int/integer - 對integer排序float/number/currency - 排序數(shù)字date - 排序日期text - 排序文本 text
stype string 定義搜索元素的類型 text
surl string 搜索數(shù)據(jù)時(shí)的url empty string
width number 默認(rèn)列的寬度,只能是象素值,不能是百分比 150
xmlmap string 定義當(dāng)前列跟返回的xml數(shù)據(jù)之間的映射關(guān)系 none
unformat function ‘unformat'單元格值 null
源碼中添加
editurl:'index.php?do=do_edit',
addurl:'index.php?do=do_add',
datatype: 'xml',
mtype: 'GET',
colNames:['ID', '任務(wù)名稱', '所屬類'
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:事務(wù);2:非事務(wù)'},editselected:'classid' },
],
添加editable后 添加也是同樣有效的;
搜索
eq 等于( = )
ne 不等于( <> )
lt 小于( < )
le 小于等于( <= )
gt 大于( > )
ge 大于等于( >= )
bw 開始于 ( LIKE val% )
bn 不開始于 ( not like val%)
in 在內(nèi) ( in ())
ni 不在內(nèi)( not in ())
ew 結(jié)束于 (LIKE %val )
en 不結(jié)束于
cn 包含 (LIKE %val% )
nc 不包含
- jqGrid用法匯總(全經(jīng)典)
- ASP.NET MVC+EF在服務(wù)端分頁使用jqGrid以及jquery Datatables的注意事項(xiàng)
- Bootstrap嵌入jqGrid,使你的table牛逼起來
- jqGrid 學(xué)習(xí)筆記整理——進(jìn)階篇(一 )
- Jqgrid之強(qiáng)大的表格插件應(yīng)用
- 通過點(diǎn)擊jqgrid表格彈出需要的表格數(shù)據(jù)
- jqGrid讀取選擇的多行的某個(gè)屬性代碼
- Jqgrid表格隨窗口大小改變而改變的簡單實(shí)例
- jqGrid隨窗口大小變化自適應(yīng)大小的示例代碼
- Jqgrid設(shè)置全選(選擇)及獲取選擇行的值示例代碼
- 獲取jqGrid中選擇的行的數(shù)據(jù)
相關(guān)文章
jQuery實(shí)現(xiàn)遍歷XML節(jié)點(diǎn)和屬性的方法示例
這篇文章主要介紹了jQuery實(shí)現(xiàn)遍歷XML節(jié)點(diǎn)和屬性的方法,涉及jQuery針對xml文件的加載、節(jié)點(diǎn)遍歷等相關(guān)操作技巧,需要的朋友可以參考下2018-04-04自己動(dòng)手實(shí)現(xiàn)jQuery Callbacks完整功能代碼詳解
最近大量的用到j(luò)Query Callbacks 對象,jQuery庫中的$.ajax()和$.Deferred() 對象也是基于這個(gè)對象實(shí)現(xiàn),下面我們也模擬實(shí)現(xiàn)jQuery Callbacks 對象的部分功能2013-11-11jquery中dom操作和事件的實(shí)例學(xué)習(xí)-表單驗(yàn)證
這個(gè)demo的效果是實(shí)現(xiàn)用戶輸入時(shí)提供實(shí)時(shí)提醒,并不一定要等到元素失去焦點(diǎn)時(shí)才提醒2011-11-11用js實(shí)現(xiàn)的模擬jquery的animate自定義動(dòng)畫(2.5K)
模仿jquery的animate寫了一個(gè)簡單的動(dòng)畫實(shí)現(xiàn)方法。2010-07-07