JQGrid搜索等功能的配置

上传人:博****1 文档编号:562160343 上传时间:2023-02-20 格式:DOCX 页数:29 大小:109.44KB
返回 下载 相关 举报
JQGrid搜索等功能的配置_第1页
第1页 / 共29页
JQGrid搜索等功能的配置_第2页
第2页 / 共29页
JQGrid搜索等功能的配置_第3页
第3页 / 共29页
JQGrid搜索等功能的配置_第4页
第4页 / 共29页
JQGrid搜索等功能的配置_第5页
第5页 / 共29页
点击查看更多>>
资源描述

《JQGrid搜索等功能的配置》由会员分享,可在线阅读,更多相关《JQGrid搜索等功能的配置(29页珍藏版)》请在金锄头文库上搜索。

1、ConfigurationThecolumnsinthegridcanbeusedasthebasisforasearchformtoappearabove,below,orinplaceof,thegrid.Searchingisawayofqueryingdatafromtheserverusingspecifiedcriteria.Currentlywedonothavemoduleforsearchingonlocaldatai.ewhenadatatypeoptionsissettolocal.Allthesearchingisdoneserverside.Therearefoura

2、pproaches:atoolbarsearchingacustomsearchingasinglefieldsearchingamorecomplexapproachinvolvingmanyfieldsandconditions-advancedsearchingTheseapproachesusecommonoptionsfromjqGridandsocanbecalledonlyonanalready-constructedgrid.Everysearchmethodrequirethatsomeadditionalmoduleshouldbeincludedintothepackag

3、e.AlsorefertDownloadorineveryspecificmoduleonwhatshouldbeincludedAllsearchmodules(exceptcustomsearchingandtoolbarsearching)usesthefollowingdefinitionfromlanguagefile:II$.jgrid=1IIsearch:caption:Search.,Find:Find,Reset:Reset,odata:equal,notequal,less,lessorequal,greater,greaterorequal,beginswith,does

4、notbeginwith,isin,isnotin,endswith,doesnotendwith,contains,doesnotcontain,groupOps:op:AND,text:all,op:OR,text:any,matchText:match,rulesText:rules,colModelOptionsAsof3.5releasejqGridusesacommonsearchoptionsthatcanbeusedoneverysearchmethod.BelowisalistoftheseoptionsthatshouldbesetincolModel.Notethatso

5、meoptionsarenotapplicableforparticularmethod.OptionTypeDesscriptionDefaultsearchbooleanDeterminesifthefieldcanbesearched.truestypestringDeterminesthesearchtypeofthefield.Canbetext-alsoainputelementwithtypetextiscreatedandselect-aselectelementiscreatedtextsearchoptionsobjectObjectwhichcontaindefiniti

6、on,eventsandotherpropertiesforthesearchedfield.SeebelowThesearchoptionsobjecthavethefollowingproperties:Thesearchoptionsarenotapplicabletocustomsearchmethod.Thismethodusesseparateoptions.PropertyTypeDescriptiondataUrlstringThisoptionisvalidonlyfortheelementsoftypeselect-i.estype:select.Theoptionrepr

7、esenttheurlfromwhereweloadtheselectelement.Whenthisoptionissettheelementwillbefilledwithvaluesfromtheajaxrequest.Thedatashouldbeavalidhtmlselectelementwiththedesiredoptions.ByexampletherequestshouldcontainOneTwo.Thisiscalledonlyonce.buildSelectfunctionThisoptionhavesenseonlyifthedataUrlparameterisse

8、t.Incasewheretheserverresponsecannotbuildtheselectelementyoucanuseyouronfunctiontobuildtheselect.Thefunctionshouldreturnastringcontainingtheselectandoptionsvalue(s)asdescribedindataUrloption.ParameterpassedtothisfunctionistheserverresponsedatalnitfunctionIfsetthisfunctioniscalledonlyoncewhentheeleme

9、ntiscreated.Tothisfunctionwepasstheelementobject.dataInit:function(elem)dosomethingAlsousethisfunctiontoattachdatepicker,timepickerandetc.Example:dataInit:function(elem)$(elem).datepicker();dataEventsarrayListofeventstoapplytothedataelement;uses$(#id).bind(type,data,fn)tobindeventstodataelement.Shou

10、ldbedescribedlikethis:dataEvents:type:click,data:i:7,fn:function(e)console.log(e.data.i);,type:keypress,fn:function(e)console.log(keypress);attrobjectattrisobjectwherewecansetvalidattributestothecreatedelement.Byexample:attr:title:SometitleWillsetatitleofthesearchedelementsearchhiddenbooleanBydefaul

11、thiddenelemntsinthegridarenotsearchable.InordertoenablesearchingwhenthefieldishiddensetthisoptiontotruesoptarrayThisoptionisusedonlyinadvancedsinglefieldsearchinganddeterminestheoperationthatisappliedtotheelement.Ifnotsetalltheavailableoptionswillbeused.Allavailableoptionare:eq,ne,lt,le,gt,ge,bw,bn,

12、in,ni,ew,en,cn,ncThecorrespondingtextsareinlanguagefileandmeanthefollowing:equal,notequal,less,lessorequal,greater,greaterorequal,beginswith,doesnotbeginwith,isin,isnotintendswith,doesnotendwith,contains,doesnotcontainNotethattheelementsinsoptarraycanbemixedinanyorder.defaultValuestringIfnotemptyset

13、adefaultvalueinthesearchinputelement.valuemixedTheoptionisusedonlyforstypeselectanddefinestheselectoptionsinthesearchdialogs.WhensetforstypeselectanddataUrloptionisnotset,thevaluecanbeastringorobject.Iftheoptionisastringitmustcontainasetofvalue:labelpairswiththevalueseparatedfromthelabelwithacolon(:

14、)andendedwith(;).Thestringshouldnotendedwitha(;)-editoptions:value:1:One;2:Two.Ifsetasobjectitshouldbedefinedaspairname:value-editoptions:value:1:One;2:TwoNote:whenthedataUrlinsearchoptionsobjectisnotusedforthesearchtypeselect,thedefinitionsfortheselectaretakenfirstfromsearchoptionsvaluepropertyandifthisisnotdefinedaeditoptionsvaluepropertyisused-i.eeditoptions:value:“1:one;2:two”,.Seebelowhowtousetheseoptionsindifferentsearchmethods.colModelconventions:script:jQuery(#grid_id).jqGrid(colModel:name:price,index:price,width:6

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 商业/管理/HR > 商业计划书

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号