JQGrid搜索等功能的配置Word文件下载.docx

上传人:b****6 文档编号:8647029 上传时间:2023-05-12 格式:DOCX 页数:27 大小:74.01KB
下载 相关 举报
JQGrid搜索等功能的配置Word文件下载.docx_第1页
第1页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第2页
第2页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第3页
第3页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第4页
第4页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第5页
第5页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第6页
第6页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第7页
第7页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第8页
第8页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第9页
第9页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第10页
第10页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第11页
第11页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第12页
第12页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第13页
第13页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第14页
第14页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第15页
第15页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第16页
第16页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第17页
第17页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第18页
第18页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第19页
第19页 / 共27页
JQGrid搜索等功能的配置Word文件下载.docx_第20页
第20页 / 共27页
亲,该文档总共27页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

JQGrid搜索等功能的配置Word文件下载.docx

《JQGrid搜索等功能的配置Word文件下载.docx》由会员分享,可在线阅读,更多相关《JQGrid搜索等功能的配置Word文件下载.docx(27页珍藏版)》请在冰点文库上搜索。

JQGrid搜索等功能的配置Word文件下载.docx

['

equal'

'

notequal'

less'

lessorequal'

'

greater'

greaterorequal'

beginswith'

doesnotbeginwith'

isin'

isnotin'

endswith'

doesnotendwith'

contains'

doesnotcontain'

],

groupOps:

[{op:

AND"

text:

all"

},{op:

OR"

any"

}],

matchText:

match"

rulesText:

rules"

},

colModelOptions

Asof3.5releasejqGridusesacommonsearchoptionsthatcanbeusedoneverysearchmethod.BelowisalistoftheseoptionsthatshouldbesetincolModel.Notethatsomeoptionsarenotapplicableforparticularmethod.

Option

Type

Desscription

Default

search

boolean

Determinesifthefieldcanbesearched.

true

stype

string

Determinesthesearchtypeofthefield.Canbetext-alsoainputelementwithtypetextiscreatedandselect-aselectelementiscreated

text

searchoptions

object

Objectwhichcontaindefinition,eventsandotherpropertiesforthesearchedfield.Seebelow

Thesearchoptionsobjecthavethefollowingproperties:

Thesearchoptionsarenotapplicabletocustomsearchmethod.Thismethodusesseparateoptions.

Property

Description

dataUrl

Thisoptionisvalidonlyfortheelementsoftypeselect-i.estype:

'

select'

.Theoptionrepresenttheurlfromwhereweloadtheselectelement.Whenthisoptionissettheelementwillbefilledwithvaluesfromtheajaxrequest.Thedatashouldbeavalidhtmlselectelementwiththedesiredoptions.Byexampletherequestshouldcontain<

select>

<

optionvalue=“1”>

One<

/option>

<

optionvalue=“2”>

Two<

/select>

.Thisiscalledonlyonce.

buildSelect

function

ThisoptionhavesenseonlyifthedataUrlparameterisset.Incasewheretheserverresponsecannotbuildtheselectelementyoucanuseyouronfunctiontobuildtheselect.Thefunctionshouldreturnastringcontainingtheselectandoptionsvalue(s)asdescribedindataUrloption.Parameterpassedtothisfunctionistheserverresponse

dataInit

Ifsetthisfunctioniscalledonlyoncewhentheelementiscreated.Tothisfunctionwepasstheelementobject.

dataInit:

function(elem){

dosomething

}

Alsousethisfunctiontoattachdatepicker,timepickerandetc.Example:

dataInit:

function(elem){

$(elem).datepicker();

}

dataEvents

array

Listofeventstoapplytothedataelement;

uses$(”#id”).bind(type,[data],fn)tobindeventstodataelement.Shouldbedescribedlikethis:

dataEvents:

[

{type:

'

click'

data:

{i:

7},fn:

function(e){console.log(e.data.i);

}},

keypress'

fn:

function(e){console.log('

);

}}

]

attr

attrisobjectwherewecansetvalidattributestothecreatedelement.Byexample:

attr:

{title:

“Sometitle”}

Willsetatitleofthesearchedelement

searchhidden

Bydefaulthiddenelemntsinthegridarenotsearchable.Inordertoenablesearchingwhenthefieldishiddensetthisoptiontotrue

sopt

Thisoptionisusedonlyinadvancedsinglefieldsearchinganddeterminestheoperationthatisappliedtotheelement.Ifnotsetalltheavailableoptionswillbeused.Allavailableoptionare:

['

eq'

ne'

lt'

le'

gt'

ge'

bw'

bn'

in'

ni'

ew'

en'

cn'

nc'

]

Thecorrespondingtextsareinlanguagefileandmeanthefollowing:

Notethattheelementsinsoptarraycanbemixedinanyorder.

defaultValue

Ifnotemptysetadefaultvalueinthesearchinputelement.

value

mixed

Theoptionisusedonlyforstypeselectanddefinestheselectoptionsinthesearchdialogs.WhensetforstypeselectanddataUrloptionisnotset,thevaluecanbeastringorobject.

Iftheoptionisastringitmustcontainasetofvalue:

labelpairswiththevalueseparatedfromthelabelwithacolon(:

)andendedwith(;

).Thestringshouldnotendedwitha(;

)-editoptions:

{value:

“1:

One;

2:

Two”}.Ifsetasobjectitshouldbedefinedaspairname:

value-editoptions:

{1:

One'

;

Two'

}}

Note:

whenthedataUrlinsearchoptionsobjectisnotusedforthesearchtypeselect,thedefinitionsfortheselectaretakenfirstfromsearchoptionsvaluepropertyandifthisisnotdefinedaeditoptionsvaluepropertyisused-i.eeditoptions:

one;

two”,…}.Seebelowhowtousetheseoptionsindifferentsearchmethods.

colModelconventions:

script>

jQuery("

#grid_id"

).jqGrid({

colModel:

...

{name:

price'

index:

width:

60,search:

true,stype:

text'

searchoptions:

{dataInit:

datePick,attr:

{title:

SelectDate'

}}},

...

]

});

datePick=function(elem)

{

jQuery(elem).datepicker();

/script>

Whatyouneedtoknow

Allsearchmodulesusestheurlparameteringridtoperformthesearch.Insomemethodsthereisadditionalseparateoptionfortheurlwhichcanbeusedtoo.

WhenthesearchisperformedthepostDataarrayisfilledwiththeneededdataforthesearch.

Theparametersearchingridoptionsissettotrueinordertoindicatethesearching.Serversidethenameofthisis_search(notethedifference)whichcanbeobtainedusingtheGETorPOSTdataarray.

WhenthegridistriggeredwhenusingtherefreshbuttoninNavigatorthesearchoptionissettofalse.

EverysearchmethodcreatesitsownmethodtoclearthesearcheddatafrompostDataarray.Usethesemethodstodothis.

ToolbarSearching

Thismethodconstructsearchingcreatinginputelementsjustbelowtheheaderelementsofthegrid.Whentheheaderelementsareresizedtheinputsearchelementsarealsoresizedaccordingtothenewwidth.

Themethodusestheurloptioningridtoperformasearchtotheserver.

Whenthesearchisactivated,anarrayoftypename:

valueispostedtotheserver.NotethatthisarrayisaddedtothepostDataparameter.Wepostonlyfieldsthathaveanenteredvalue.Whenweclearthethesearchform,thevaluesaredeletedfromthepostDataarray.Whenpostingtotheserver,wetrytopass,notthename,buttheindexsetincolModel.Whentheindexisnotfoundweusethename.Additionally,weadda_search=truetotheposteddata.

Installation

InordertousethismethodaCustommoduleshouldbecheckedwhenyoudownloadthegrid.FormoreinformationrefertoDownload

CallingConvetion

).filterToolbar(options);

orusingthenewAPI

).jqGrid('

filterToolbar'

options);

Where:

grid_idistheidofalreadyconstructedgrid

optionsisaobjectcontainingdifferentconfigurationsetting.Seebelow

Thiscommandwillcreateasearchelementssomethinglikethis:

ThismethodusesthedefinitionsforsearchingfromcolModel.SeeConfiguration

TheoptionsinfilterToolbarmethodare

type

autosearch

Searchisperformedaccordingtothefollowingrules:

fortextelementwhenaEnterkeyispressedwhileinputtingvaluesandsearchisperformed.Forselectelementwhenthevaluechanges.Thesearchparameteringridissettotrueandajaxcallismade.

beforeSearch

eventwhichfiresbeforeasearch.Itiscalledbeforetriggeringthegrid.Iftheeventreturntruetriggeringdoesnotoccur.Inthiscaseyoucanconstructyourownsearchparametersandtriggerthegridtosearchthedata.Anyotherreturnvaluecausestriggering.

null

afterSearch

eventwhichfiresafterasearch

beforeClear

eventwhichfiresbeforeclearingenteredvalues(i.e.,clearToolbarisactivated).Itiscalledbeforeclearingthedatafromsearchelements.Iftheeventreturntruetriggeringdoesnotoccur.Inthiscaseyoucanconstructyourownsearchparametersandtriggerthegrid.Anyotherreturnvaluecausestriggering.

afterClear

eventwhichfiresafterclearingenteredvalues(i.e.,clearToolbaractivated)

Thesoptoptioninsearchoptionsdoesnothaveefectinthismethod.

WhenwecreatetoolbarsearchwithfilterToolbarwecreateadditionalmethodsasfollow

Method

triggerToolbar

Whenthismethodiscalledasearchisperformed,thesearchparameteringridbecomestrueandajaxcallismadetotheserver

clearToolbar

Whencalledclearthesearchvaluessendarequestwithsearchoptionsettofalseandsetthedefaultoneifavailable

toggleToolbar

Toggelesthetoolbarwiththesearchelements

Usingtheadditionalmethods

Themethodslistedaboveshouldbeusedthisway:

varsgrid=$("

)[0];

sgrid.triggerToolbar();

CustomSearching

Thismethodcanbecalledtoconstructancustomsearchformforthegrid.

Themethodusesthe

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 解决方案 > 学习计划

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2