jqxgrid.js 419 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841
  1. /*
  2. jQWidgets v8.1.4 (2019-July)
  3. Copyright (c) 2011-2019 jQWidgets.
  4. License: https://jqwidgets.com/license/
  5. */
  6. /* eslint-disable */
  7. (function (b) {
  8. b.jqx.jqxWidget("jqxGrid", "", {});
  9. b.extend(b.jqx._jqxGrid.prototype, {
  10. defineInstance: function () {
  11. var d = {
  12. adaptive: false,
  13. adaptivewidth: 600,
  14. disabled: false,
  15. width: 600,
  16. height: 400,
  17. pagerheight: 40,
  18. groupsheaderheight: 34,
  19. pagesize: 10,
  20. pagesizeoptions: ["5", "10", "20"],
  21. rowsheight: 32,
  22. columnsheight: 32,
  23. filterrowheight: 36,
  24. groupindentwidth: 30,
  25. rowdetails: false,
  26. enablerowdetailsindent: true,
  27. enablemousewheel: true,
  28. initrowdetails: null,
  29. layoutrowdetails: null,
  30. editable: false,
  31. editmode: "selectedcell",
  32. pageable: false,
  33. pagermode: "default",
  34. pagerbuttonscount: 5,
  35. groupable: false,
  36. sortable: false,
  37. sortmode: "one",
  38. filterable: false,
  39. filtermode: "default",
  40. autoshowfiltericon: true,
  41. showfiltercolumnbackground: true,
  42. showpinnedcolumnbackground: true,
  43. showsortcolumnbackground: true,
  44. altrows: false,
  45. altstart: 1,
  46. altstep: 1,
  47. showrowdetailscolumn: true,
  48. showrowlines: true,
  49. showcolumnlines: true,
  50. showcolumnheaderlines: true,
  51. showtoolbar: false,
  52. toolbarheight: 36,
  53. showstatusbar: false,
  54. statusbarheight: 36,
  55. enableellipsis: true,
  56. groups: [],
  57. groupsrenderer: null,
  58. groupcolumnrenderer: null,
  59. groupsexpandedbydefault: false,
  60. pagerrenderer: null,
  61. touchmode: "auto",
  62. columns: [],
  63. selectedrowindex: -1,
  64. selectedrowindexes: new Array(),
  65. selectedcells: new Array(),
  66. autobind: true,
  67. selectedcell: null,
  68. tableZIndex: 79,
  69. headerZIndex: 29,
  70. updatefilterconditions: null,
  71. showgroupaggregates: false,
  72. showaggregates: false,
  73. showfilterrow: false,
  74. showeverpresentrow: false,
  75. everpresentrowposition: "top",
  76. everpresentrowactions: "add reset",
  77. everpresentrowactionsmode: "buttons",
  78. everpresentrowheight: 30,
  79. autorowheight: false,
  80. autokoupdates: true,
  81. handlekeyboardnavigation: null,
  82. showsortmenuitems: true,
  83. showfiltermenuitems: true,
  84. showgroupmenuitems: true,
  85. enablebrowserselection: false,
  86. enablekeyboarddelete: true,
  87. clipboard: true,
  88. clipboardbegin: null,
  89. clipboardend: null,
  90. copytoclipboardwithheaders: false,
  91. copytoclipboardhiddencolumns: false,
  92. ready: null,
  93. updatefilterpanel: null,
  94. autogeneratecolumns: false,
  95. rowdetailstemplate: null,
  96. scrollfeedback: null,
  97. rendertoolbar: null,
  98. renderstatusbar: null,
  99. rendered: null,
  100. multipleselectionbegins: null,
  101. columngroups: null,
  102. cellhover: null,
  103. source: {
  104. beforeprocessing: null,
  105. beforesend: null,
  106. loaderror: null,
  107. localdata: null,
  108. data: null,
  109. datatype: "array",
  110. datafields: [],
  111. url: "",
  112. root: "",
  113. record: "",
  114. id: "",
  115. totalrecords: 0,
  116. recordstartindex: 0,
  117. recordendindex: 0,
  118. loadallrecords: true,
  119. sortcolumn: null,
  120. sortdirection: null,
  121. sort: null,
  122. filter: null,
  123. sortcomparer: null
  124. },
  125. filter: null,
  126. dataview: null,
  127. updatedelay: null,
  128. autoheight: false,
  129. autowidth: false,
  130. showheader: true,
  131. showgroupsheader: true,
  132. closeablegroups: true,
  133. scrollbarsize: b.jqx.utilities.scrollBarSize,
  134. touchscrollbarsize: b.jqx.utilities.touchScrollBarSize,
  135. scrollbarautoshow: b.jqx.utilities.scrollBarAutoShow,
  136. virtualmode: false,
  137. sort: null,
  138. columnsmenu: true,
  139. columnsresize: false,
  140. columnsautoresize: true,
  141. columnsreorder: false,
  142. columnsmenuwidth: 16,
  143. autoshowcolumnsmenubutton: true,
  144. showcolumnsactionbutton: false,
  145. popupwidth: "auto",
  146. popupheight: "auto",
  147. columnmenuopening: null,
  148. columnmenuclosing: null,
  149. sorttogglestates: 2,
  150. rendergridrows: null,
  151. enableanimations: true,
  152. enablecolumnsvirtualization: true,
  153. enabletooltips: false,
  154. selectionmode: "singlerow",
  155. enablehover: true,
  156. loadingerrormessage: "The data is still loading. When the data binding is completed, the Grid raises the 'bindingcomplete' event. Call this function in the 'bindingcomplete' event handler.",
  157. verticalscrollbarstep: 30,
  158. verticalscrollbarlargestep: 400,
  159. horizontalscrollbarstep: 10,
  160. horizontalscrollbarlargestep: 50,
  161. keyboardnavigation: true,
  162. keyboardmenunavigation: true,
  163. touchModeStyle: "auto",
  164. autoshowloadelement: true,
  165. showdefaultloadelement: true,
  166. showemptyrow: true,
  167. autosavestate: false,
  168. autoloadstate: false,
  169. _updating: false,
  170. _pagescache: new Array(),
  171. _pageviews: new Array(),
  172. _cellscache: new Array(),
  173. _rowdetailscache: new Array(),
  174. _rowdetailselementscache: new Array(),
  175. _requiresupdate: false,
  176. _hasOpenedMenu: false,
  177. scrollmode: "physical",
  178. deferreddatafields: null,
  179. localization: null,
  180. rtl: false,
  181. menuitemsarray: [],
  182. events: ["initialized", "rowClick", "rowSelect", "rowUnselect", "groupExpand", "groupCollapse", "sort", "columnClick", "cellClick", "pageChanged", "pageSizeChanged", "bindingComplete", "groupsChanged", "filter", "columnResized", "cellSelect", "cellUnselect", "cellBeginEdit", "cellEndEdit", "cellValueChanged", "rowExpand", "rowCollapse", "rowDoubleClick", "cellDoubleClick", "columnReordered", "pageChanging"]
  183. };
  184. if (this === b.jqx._jqxGrid.prototype) {return d;}
  185. b.extend(true, this, d);
  186. return d;
  187. },
  188. createInstance: function (i) {
  189. this.that = this;
  190. var h = this;
  191. h.pagesize = parseInt(h.pagesize);
  192. h.toolbarheight = parseInt(h.toolbarheight);
  193. h.columnsheight = parseInt(h.columnsheight);
  194. h.filterrowheight = parseInt(h.filterrowheight);
  195. h.statusbarheight = parseInt(h.statusbarheight);
  196. h.groupsheaderheight = parseInt(h.groupsheaderheight);
  197. h.detailsVisibility = new Array();
  198. h.savedArgs = i && i.length > 0 ? i[0] : null;
  199. var g = "<div class='jqx-clear jqx-border-reset jqx-overflow-hidden jqx-max-size jqx-position-relative'><div tabindex='1' class='jqx-clear jqx-max-size jqx-position-relative jqx-overflow-hidden jqx-background-reset' id='wrapper" + h.element.id + "'><div class='jqx-clear jqx-position-absolute' id='toolbar' style='visibility: hidden;'></div><div class='jqx-clear jqx-position-absolute' id='groupsheader' style='visibility: hidden;'></div><div class='jqx-clear jqx-overflow-hidden jqx-position-absolute jqx-border-reset jqx-background-reset' id='content" + h.element.id + "'></div><div class='jqx-clear jqx-position-absolute' id='verticalScrollBar" + h.element.id + "'></div><div class='jqx-clear jqx-position-absolute' id='horizontalScrollBar" + h.element.id + "'></div><div class='jqx-clear jqx-position-absolute jqx-border-reset' id='bottomRight'></div><div class='jqx-clear jqx-position-absolute' id='addrow'></div><div class='jqx-clear jqx-position-absolute' id='statusbar'></div><div class='jqx-clear jqx-position-absolute' id='pager' style='z-index: 20;'></div></div></div>";
  200. h.element.innerHTML = "";
  201. if (h.source) {
  202. if (!h.source.dataBind) {
  203. if (!b.jqx.dataAdapter) {throw new Error("jqxGrid: Missing reference to jqxdata.js");}
  204. h.source = new b.jqx.dataAdapter(h.source);
  205. }
  206. var e = h.source._source.datafields;
  207. if (e && e.length > 0) {
  208. h.editmode = h.editmode.toLowerCase();
  209. h.selectionmode = h.selectionmode.toLowerCase();
  210. }
  211. }
  212. h.host.attr("role", "grid");
  213. h.host.attr("align", "left");
  214. h.element.innerHTML = g;
  215. h.host.addClass(h.toTP("jqx-grid"));
  216. h.host.addClass(h.toTP("jqx-reset"));
  217. h.host.addClass(h.toTP("jqx-rc-all"));
  218. h.host.addClass(h.toTP("jqx-widget"));
  219. h.host.addClass(h.toTP("jqx-widget-content"));
  220. h.wrapper = h.host.find("#wrapper" + h.element.id);
  221. h.content = h.host.find("#content" + h.element.id);
  222. h.content.addClass(h.toTP("jqx-reset"));
  223. var n = h.host.find("#verticalScrollBar" + h.element.id);
  224. var r = h.host.find("#horizontalScrollBar" + h.element.id);
  225. h.bottomRight = h.host.find("#bottomRight").addClass(h.toTP("jqx-grid-bottomright jqx-scrollbar-state-normal"));
  226. if (!n.jqxScrollBar) {
  227. throw new Error("jqxGrid: Missing reference to jqxscrollbar.js");
  228. return;
  229. }
  230. h.editors = new Array();
  231. h.vScrollBar = n.jqxScrollBar({ vertical: true, rtl: h.rtl, touchMode: h.touchmode, step: h.verticalscrollbarstep, largestep: h.verticalscrollbarlargestep, theme: h.theme, _triggervaluechanged: false });
  232. h.hScrollBar = r.jqxScrollBar({ vertical: false, rtl: h.rtl, touchMode: h.touchmode, step: h.horizontalscrollbarstep, largestep: h.horizontalscrollbarlargestep, theme: h.theme, _triggervaluechanged: false });
  233. h.addnewrow = h.host.find("#addrow");
  234. h.addnewrow[0].id = "addrow" + h.element.id;
  235. h.addnewrow.addClass(h.toTP("jqx-widget-header"));
  236. h.pager = h.host.find("#pager");
  237. h.pager[0].id = "pager" + h.element.id;
  238. h.toolbar = h.host.find("#toolbar");
  239. h.toolbar[0].id = "toolbar" + h.element.id;
  240. h.toolbar.addClass(h.toTP("jqx-grid-toolbar"));
  241. h.toolbar.addClass(h.toTP("jqx-widget-header"));
  242. h.statusbar = h.host.find("#statusbar");
  243. h.statusbar[0].id = "statusbar" + h.element.id;
  244. h.statusbar.addClass(h.toTP("jqx-grid-statusbar"));
  245. h.statusbar.addClass(h.toTP("jqx-widget-header"));
  246. h.pager.addClass(h.toTP("jqx-grid-pager"));
  247. h.pager.addClass(h.toTP("jqx-widget-header"));
  248. h.groupsheader = h.host.find("#groupsheader");
  249. h.groupsheader.addClass(h.toTP("jqx-grid-groups-header"));
  250. h.groupsheader.addClass(h.toTP("jqx-widget-header"));
  251. h.groupsheader[0].id = "groupsheader" + h.element.id;
  252. h.vScrollBar.css("visibility", "hidden");
  253. h.hScrollBar.css("visibility", "hidden");
  254. h.vScrollInstance = b.data(h.vScrollBar[0], "jqxScrollBar").instance;
  255. h.hScrollInstance = b.data(h.hScrollBar[0], "jqxScrollBar").instance;
  256. h.gridtable = null;
  257. h.isNestedGrid = h.host.parent() ? h.host.parent().css("z-index") == 299 : false;
  258. h.touchdevice = h.isTouchDevice();
  259. if (h.localizestrings) {
  260. h.localizestrings();
  261. if (h.localization != null) {h.localizestrings(h.localization, false);}
  262. }
  263. if (h.rowdetailstemplate && typeof h.rowdetailstemplate !== "function") {
  264. if (undefined == h.rowdetailstemplate.rowdetails) {h.rowdetailstemplate.rowdetails = "<div></div>";}
  265. if (undefined == h.rowdetailstemplate.rowdetailsheight) {h.rowdetailstemplate.rowdetailsheight = 200;}
  266. if (undefined == h.rowdetailstemplate.rowdetailshidden) {h.rowdetailstemplate.rowdetailshidden = true;}
  267. }
  268. if (h.showfilterrow && !h.filterable) {
  269. throw new Error('jqxGrid: "showfilterrow" requires setting the "filterable" property to true!');
  270. h.host.remove();
  271. return;
  272. }
  273. if (h.autorowheight && !h.autoheight && !h.pageable) {
  274. throw new Error('jqxGrid: "autorowheight" requires setting the "autoheight" or "pageable" property to true!');
  275. h.host.remove();
  276. return;
  277. }
  278. if (h.virtualmode && h.rendergridrows == null) {
  279. throw new Error('jqxGrid: "virtualmode" requires setting the "rendergridrows"!');
  280. h.host.remove();
  281. return;
  282. }
  283. if (h.virtualmode && !h.pageable && h.groupable) {
  284. throw new Error('jqxGrid: "grouping" in "virtualmode" without paging is not supported!');
  285. h.host.remove();
  286. return;
  287. }
  288. if (h._testmodules()) {return;}
  289. h._builddataloadelement();
  290. h._cachedcolumns = h.columns;
  291. if (h.columns && h.columns.length > h.headerZIndex) {h.headerZIndex = h.columns.length + 100;}
  292. if (h.theme && h.theme.indexOf("material") >= 0) {
  293. var o = b("<span>Test</span>");
  294. var f = b("<span>Test</span>");
  295. o.addClass(h.toTP("jqx-grid-row-cell"));
  296. f.addClass(h.toTP("jqx-grid-column-header-cell"));
  297. h.host.append(o);
  298. h.host.append(f);
  299. var l = o.outerHeight();
  300. var k = f.outerHeight();
  301. if (l > this.rowsheight) {
  302. h.rowsheight = l;
  303. this._cellheight = l;
  304. }
  305. if (k > this.columnsheight) {
  306. h.columnsheight = k;
  307. this._columnHeight = k;
  308. }
  309. o.remove();
  310. f.remove();
  311. }
  312. if (h.rowsheight != 31) {h._measureElement("cell");}
  313. if (h.columnsheight != 32 || h.columngroups) {h._measureElement("column");}
  314. if (h.source) {
  315. var e = h.source.datafields;
  316. if (e == null && h.source._source) {e = h.source._source.datafields;}
  317. if (e) {
  318. for (var d = 0; d < h.columns.length; d++) {
  319. var f = h.columns[d];
  320. if (f && f.cellsformat && f.cellsformat.length > 2) {
  321. for (var q = 0; q < e.length; q++) {
  322. if (e[q].name == f.datafield && !e[q].format) {
  323. e[q].format = f.cellsformat;
  324. break;
  325. }
  326. }
  327. }
  328. }
  329. }
  330. }
  331. h.databind(h.source);
  332. if (h.showtoolbar) {h.toolbar.css("visibility", "inherit");}
  333. if (h.showstatusbar) {h.statusbar.css("visibility", "inherit");}
  334. h._arrange();
  335. if (h.pageable && h._initpager) {h._initpager();}
  336. h.tableheight = null;
  337. var j = h.that;
  338. var p = function () {
  339. if (j.content) {
  340. j.content[0].scrollTop = 0;
  341. j.content[0].scrollLeft = 0;
  342. }
  343. if (j.gridcontent) {
  344. j.gridcontent[0].scrollLeft = 0;
  345. j.gridcontent[0].scrollTop = 0;
  346. }
  347. };
  348. h.addHandler(h.content, "mousedown", function () {p();});
  349. h.addHandler(h.content, "scroll", function (m) {
  350. p();
  351. return false;
  352. });
  353. if (!h.showfilterrow) {
  354. if (!h.showstatusbar && !h.showtoolbar) {h.host.addClass("jqx-disableselect");}
  355. h.content.addClass("jqx-disableselect");
  356. }
  357. if (h.enablebrowserselection) {
  358. h.content.removeClass("jqx-disableselect");
  359. h.host.removeClass("jqx-disableselect");
  360. }
  361. h._resizeWindow();
  362. if (h.disabled) {h.host.addClass(h.toThemeProperty("jqx-fill-state-disabled"));}
  363. h.hasTransform = b.jqx.utilities.hasTransform(h.host);
  364. if (h.scrollmode == "logical") {
  365. h.vScrollInstance.thumbStep = h.rowsheight;
  366. h.vScrollInstance.step = h.rowsheight;
  367. }
  368. if (!b.jqx.isHidden(h.host)) {if (h.filterable || h.groupable || h.sortable) {h._initmenu();}}
  369. },
  370. _resizeWindow: function () {
  371. var e = this.that;
  372. if ((this.width != null && this.width.toString().indexOf("%") != -1) || (this.height != null && this.height.toString().indexOf("%") != -1)) {
  373. this._updatesizeonwindowresize = true;
  374. b.jqx.utilities.resize(this.host, function (k) {
  375. var j = b(window).width();
  376. var g = b(window).height();
  377. var i = e.host.width();
  378. var l = e.host.height();
  379. if (e.pageable) {
  380. var h = e.host.find(".jqx-grid-pager-input");
  381. if (j < 350) {h.hide();} else {h.show();}
  382. }
  383. if (e.autoheight) {e._lastHostWidth = g;}
  384. if (e._lastHostWidth != i || e._lastHostHeight != l) {
  385. if (e.touchdevice && e.editcell && k !== "orientationchange") {return;}
  386. e._updatesize(e._lastHostWidth != i, e._lastHostHeight != l);
  387. }
  388. e._lastWidth = j;
  389. e._lastHeight = g;
  390. e._lastHostWidth = i;
  391. e._lastHostHeight = l;
  392. });
  393. var d = e.host.width();
  394. var f = e.host.height();
  395. e._lastHostWidth = d;
  396. e._lastHostHeight = f;
  397. }
  398. },
  399. _builddataloadelement: function () {
  400. if (this.dataloadelement) {this.dataloadelement.remove();}
  401. this.dataloadelement = b('<div style="overflow: hidden; position: absolute;"></div>');
  402. if (this.showdefaultloadelement) {
  403. var d = b('<div style="z-index: 99; margin-left: -66px; left: 50%; top: 50%; margin-top: -24px; position: relative; width: 100px; height: 33px; padding: 5px; font-family: verdana; font-size: 12px; color: #767676; border-color: #898989; border-width: 1px; border-style: solid; background: #f6f6f6; border-collapse: collapse;"><div style="float: left;"><div style="float: left; overflow: hidden; width: 32px; height: 32px;" class="jqx-grid-load"/><span style="margin-top: 10px; float: left; display: block; margin-left: 5px;" >' + this.gridlocalization.loadtext + "</span></div></div>");
  404. d.addClass(this.toTP("jqx-rc-all"));
  405. this.dataloadelement.addClass(this.toTP("jqx-rc-all"));
  406. d.addClass(this.toTP("jqx-fill-state-normal"));
  407. this.dataloadelement.append(d);
  408. } else {this.dataloadelement.addClass(this.toTP("jqx-grid-load"));}
  409. this.dataloadelement.width(this.host.width());
  410. this.dataloadelement.height(this.host.height());
  411. this.wrapper.prepend(this.dataloadelement);
  412. },
  413. _measureElement: function (e) {
  414. var d = b("<span style='visibility: hidden; white-space: nowrap;'>measure Text</span>");
  415. d.addClass(this.toTP("jqx-widget"));
  416. b(document.body).append(d);
  417. if (e == "cell") {this._cellheight = d.height();} else {this._columnheight = d.height();}
  418. d.remove();
  419. },
  420. _measureMenuElement: function () {
  421. var e = b("<span style='visibility: hidden; white-space: nowrap;'>measure Text</span>");
  422. e.addClass(this.toTP("jqx-widget"));
  423. e.addClass(this.toTP("jqx-menu"));
  424. e.addClass(this.toTP("jqx-menu-item-top"));
  425. e.addClass(this.toTP("jqx-fill-state-normal"));
  426. if (this.isTouchDevice()) {e.addClass(this.toTP("jqx-grid-menu-item-touch"));}
  427. b(document.body).append(e);
  428. var d = e.outerHeight();
  429. e.remove();
  430. return d;
  431. },
  432. _measureElementWidth: function (f) {
  433. var e = b("<span style='visibility: hidden; white-space: nowrap;'>" + f + "</span>");
  434. e.addClass(this.toTP("jqx-widget"));
  435. e.addClass(this.toTP("jqx-grid"));
  436. e.addClass(this.toTP("jqx-grid-column-header"));
  437. e.addClass(this.toTP("jqx-widget-header"));
  438. b(document.body).append(e);
  439. var d = e.outerWidth() + 20;
  440. e.remove();
  441. return d;
  442. },
  443. _getBodyOffset: function () {
  444. var e = 0;
  445. var d = 0;
  446. if (b("body").css("border-top-width") != "0px") {
  447. e = parseInt(b("body").css("border-top-width"));
  448. if (isNaN(e)) {e = 0;}
  449. }
  450. if (b("body").css("border-left-width") != "0px") {
  451. d = parseInt(b("body").css("border-left-width"));
  452. if (isNaN(d)) {d = 0;}
  453. }
  454. return { left: d, top: e };
  455. },
  456. _testmodules: function () {
  457. var k = "";
  458. var h = this.that;
  459. var d = function () {if (k.length != "") {k += ",";}};
  460. if (this.columnsmenu && !this.host.jqxMenu && (this.sortable || this.groupable || this.filterable)) {
  461. d();
  462. k += " jqxmenu.js";
  463. }
  464. if (!this.host.jqxScrollBar) {
  465. d();
  466. k += " jqxscrollbar.js";
  467. }
  468. if (!this.host.jqxButton) {
  469. d();
  470. k += " jqxbuttons.js";
  471. }
  472. if (!b.jqx.dataAdapter) {
  473. d();
  474. k += " jqxdata.js";
  475. }
  476. if (this.pageable && !this.gotopage) {
  477. d();
  478. k += "jqxgrid.pager.js";
  479. }
  480. if (this.filterable && !this.applyfilters) {
  481. d();
  482. k += " jqxgrid.filter.js";
  483. }
  484. if (this.groupable && !this._initgroupsheader) {
  485. d();
  486. k += " jqxgrid.grouping.js";
  487. }
  488. if (this.columnsresize && !this.autoresizecolumns) {
  489. d();
  490. k += " jqxgrid.columnsresize.js";
  491. }
  492. if (this.columnsreorder && !this.setcolumnindex) {
  493. d();
  494. k += " jqxgrid.columnsreorder.js";
  495. }
  496. if (this.sortable && !this.sortby) {
  497. d();
  498. k += " jqxgrid.sort.js";
  499. }
  500. if (this.editable && !this.begincelledit) {
  501. d();
  502. k += " jqxgrid.edit.js";
  503. }
  504. if (this.showaggregates && !this.getcolumnaggregateddata) {
  505. d();
  506. k += " jqxgrid.aggregates.js";
  507. }
  508. if (this.keyboardnavigation && !this.selectrow) {
  509. d();
  510. k += " jqxgrid.selection.js";
  511. }
  512. if (k != "" || this.editable || this.filterable || this.pageable) {
  513. var f = [];
  514. var j = function (i) {
  515. switch (i) {
  516. case"checkbox":
  517. if (!h.host.jqxCheckBox && !f.checkbox) {
  518. f.checkbox = true;
  519. d();
  520. k += " jqxcheckbox.js";
  521. }
  522. break;
  523. case"numberinput":
  524. if (!h.host.jqxNumberInput && !f.numberinput) {
  525. f.numberinput = true;
  526. d();
  527. k += " jqxnumberinput.js";
  528. }
  529. break;
  530. case"datetimeinput":
  531. if (!h.host.jqxDateTimeInput && !f.datetimeinput) {
  532. d();
  533. f.datetimeinput = true;
  534. k += " jqxdatetimeinput.js(requires: jqxcalendar.js)";
  535. } else {
  536. if (!h.host.jqxCalendar && !f.calendar) {
  537. d();
  538. k += " jqxcalendar.js";
  539. }
  540. }
  541. break;
  542. case"combobox":
  543. if (!h.host.jqxComboBox && !f.combobox) {
  544. d();
  545. f.combobox = true;
  546. k += " jqxcombobox.js(requires: jqxlistbox.js)";
  547. } else {
  548. if (!h.host.jqxListBox && !f.listbox) {
  549. d();
  550. f.listbox = true;
  551. k += " jqxlistbox.js";
  552. }
  553. }
  554. break;
  555. case"dropdownlist":
  556. if (!h.host.jqxDropDownList && !f.dropdownlist) {
  557. d();
  558. f.dropdownlist = true;
  559. k += " jqxdropdownlist.js(requires: jqxlistbox.js)";
  560. } else {
  561. if (!h.host.jqxListBox && !f.listbox) {
  562. d();
  563. f.listbox = true;
  564. k += " jqxlistbox.js";
  565. }
  566. }
  567. break;
  568. }
  569. };
  570. if (this.filterable || this.pageable) {j("dropdownlist");}
  571. for (var e = 0; e < this.columns.length; e++) {
  572. if (this.columns[e] == undefined) {continue;}
  573. var g = this.columns[e].columntype;
  574. j(g);
  575. if (this.filterable && this.showfilterrow) {
  576. var g = this.columns[e].filtertype;
  577. if (g == "checkedlist" || g == "bool") {j("checkbox");}
  578. if (g == "date") {j("datetimeinput");}
  579. }
  580. }
  581. if (k != "") {
  582. throw new Error("jqxGrid: Missing references to the following module(s): " + k);
  583. this.host.remove();
  584. return true;
  585. }
  586. }
  587. return false;
  588. },
  589. focus: function () {
  590. try {
  591. this.wrapper.focus();
  592. var e = this.that;
  593. setTimeout(function () {e.wrapper.focus();}, 25);
  594. this.focused = true;
  595. } catch (d) {}
  596. },
  597. hiddenParent: function () {return b.jqx.isHidden(this.host);},
  598. resize: function (e, d) {
  599. this.width = e;
  600. this.height = d;
  601. this._updatesize(true, true);
  602. },
  603. _updatesize: function (r, g) {
  604. if (this._loading) {return;}
  605. var m = this.that;
  606. m._newmax = null;
  607. var p = m.host.width();
  608. var d = m.host.height();
  609. if (!m._oldWidth) {m._oldWidth = p;}
  610. if (!m._oldHeight) {m._oldHeight = d;}
  611. if (m._resizeTimer) {clearTimeout(m._resizeTimer);}
  612. var h = 5;
  613. m.resizingGrid = true;
  614. if (b.jqx.isHidden(m.host)) {return;}
  615. if (m.editcell) {
  616. m.endcelledit(m.editcell.row, m.editcell.column, true, true);
  617. m._oldselectedcell = null;
  618. }
  619. if (d != m._oldHeight || g == true) {
  620. var e = m.groupable && m.groups.length > 0;
  621. var n = m.vScrollBar.css("visibility");
  622. if (!m.autoheight) {
  623. if (m.virtualmode) {m._pageviews = new Array();}
  624. if (!e && !m.rowdetails && !m.pageable) {
  625. m._arrange();
  626. m.virtualsizeinfo = m._calculatevirtualheight();
  627. var d = Math.round(m.host.height()) + 2 * m.rowsheight;
  628. if (parseInt(d) >= parseInt(m._oldHeight)) {m.prerenderrequired = true;}
  629. m._renderrows(m.virtualsizeinfo);
  630. if (m.rtl) {
  631. m._updatecolumnwidths();
  632. if (m.table) {m.table.width(m.columnsheader.width());}
  633. m._updatecellwidths();
  634. }
  635. } else {
  636. m._arrange();
  637. m.prerenderrequired = true;
  638. var d = Math.round(m.host.height()) + 2 * m.rowsheight;
  639. var k = m._gettableheight();
  640. var q = Math.round(d / m.rowsheight);
  641. var i = Math.max(m.dataview.totalrows, m.dataview.totalrecords);
  642. if (m.pageable) {
  643. i = m.pagesize;
  644. if (m.pagesize > Math.max(m.dataview.totalrows, m.dataview.totalrecords) && m.autoheight) {i = Math.max(m.dataview.totalrows, m.dataview.totalrecords);} else {if (!m.autoheight) {if (m.dataview.totalrows < m.pagesize) {i = Math.max(m.dataview.totalrows, m.dataview.totalrecords);}}}
  645. }
  646. var l = i * m.rowsheight;
  647. var f = m._getpagesize();
  648. if (!m.pageable && m.autoheight) {q = i;}
  649. if (m.virtualsizeinfo) {m.virtualsizeinfo.visiblerecords = q;}
  650. m.rendergridcontent(true, false);
  651. m._renderrows(m.virtualsizeinfo);
  652. }
  653. if (n != m.vScrollBar.css("visibility")) {
  654. m.vScrollInstance.setPosition(0);
  655. m._arrange();
  656. m._updatecolumnwidths();
  657. if (m.table) {m.table.width(m.columnsheader.width());}
  658. m._updatecellwidths();
  659. }
  660. }
  661. }
  662. if (p != m._oldWidth || r == true) {
  663. var o = false;
  664. if (m.editcell && m.editcell.editor) {
  665. switch (m.editcell.columntype) {
  666. case"dropdownlist":
  667. o = m.editcell.editor.jqxDropDownList("isOpened") || (m.editcell.editor.jqxDropDownList("isanimating") && !m.editcell.editor.jqxDropDownList("ishiding"));
  668. if (o) {
  669. m.editcell.editor.jqxDropDownList({ openDelay: 0 });
  670. m.editcell.editor.jqxDropDownList("open");
  671. m.editcell.editor.jqxDropDownList({ openDelay: 250 });
  672. return;
  673. }
  674. break;
  675. case"combobox":
  676. o = m.editcell.editor.jqxComboBox("isOpened") || (m.editcell.editor.jqxComboBox("isanimating") && !m.editcell.editor.jqxComboBox("ishiding"));
  677. if (o) {
  678. m.editcell.editor.jqxComboBox({ openDelay: 0 });
  679. m.editcell.editor.jqxComboBox("open");
  680. m.editcell.editor.jqxComboBox({ openDelay: 250 });
  681. return;
  682. }
  683. break;
  684. case"datetimeinput":
  685. if (o) {
  686. o = m.editcell.editor.jqxDateTimeInput("isOpened") || (m.editcell.editor.jqxDateTimeInput("isanimating") && !m.editcell.editor.jqxDateTimeInput("ishiding"));
  687. m.editcell.editor.jqxDateTimeInput({ openDelay: 0 });
  688. m.editcell.editor.jqxDateTimeInput("open");
  689. m.editcell.editor.jqxDateTimeInput({ openDelay: 250 });
  690. return;
  691. }
  692. break;
  693. }
  694. }
  695. var j = m.hScrollBar.css("visibility");
  696. m._arrange();
  697. m._updatecolumnwidths();
  698. if (m.table) {m.table.width(m.columnsheader.width());}
  699. m._updatecellwidths();
  700. if (!(r == false && m._oldWidth > p)) {if (!g || m.dataview.rows.length == 0) {m._renderrows(m.virtualsizeinfo);}}
  701. if (j != m.hScrollBar.css("visibility")) {m.hScrollInstance.setPosition(0);}
  702. }
  703. m._oldWidth = p;
  704. m._oldHeight = d;
  705. m.resizingGrid = false;
  706. },
  707. getTouches: function (d) {return b.jqx.mobile.getTouches(d);},
  708. _updateTouchScrolling: function () {
  709. var e = this.that;
  710. if (e.isTouchDevice()) {
  711. e.scrollmode = "logical";
  712. e.vScrollInstance.thumbStep = e.rowsheight;
  713. var g = b.jqx.mobile.getTouchEventName("touchstart");
  714. var f = b.jqx.mobile.getTouchEventName("touchend");
  715. var d = b.jqx.mobile.getTouchEventName("touchmove");
  716. e.enablehover = false;
  717. if (e.gridcontent) {
  718. e.removeHandler(e.gridcontent, g + ".touchScroll");
  719. e.removeHandler(e.gridcontent, d + ".touchScroll");
  720. e.removeHandler(e.gridcontent, f + ".touchScroll");
  721. e.removeHandler(e.gridcontent, "touchcancel.touchScroll");
  722. b.jqx.mobile.touchScroll(e.gridcontent[0], e.vScrollInstance.max, function (i, h) {
  723. if (h != null && e.vScrollBar.css("visibility") == "visible") {e.vScrollInstance.setPosition(h);}
  724. if (i != null && e.hScrollBar.css("visibility") == "visible") {e.hScrollInstance.setPosition(i);}
  725. e.vScrollInstance.thumbCapture = true;
  726. e._lastScroll = new Date();
  727. }, this.element.id, this.hScrollBar, this.vScrollBar);
  728. if (e._overlayElement) {
  729. e.removeHandler(e._overlayElement, g + ".touchScroll");
  730. e.removeHandler(e._overlayElement, d + ".touchScroll");
  731. e.removeHandler(e._overlayElement, f + ".touchScroll");
  732. e.removeHandler(e._overlayElement, "touchcancel.touchScroll");
  733. b.jqx.mobile.touchScroll(e._overlayElement[0], e.vScrollInstance.max, function (i, h) {
  734. if (h != null && e.vScrollBar.css("visibility") == "visible") {e.vScrollInstance.setPosition(h);}
  735. if (i != null && e.hScrollBar.css("visibility") == "visible") {e.hScrollInstance.setPosition(i);}
  736. e.vScrollInstance.thumbCapture = true;
  737. e._lastScroll = new Date();
  738. }, this.element.id, this.hScrollBar, this.vScrollBar);
  739. this.addHandler(this.host, g, function () {if (!e.editcell) {e._overlayElement.css("visibility", "visible");} else {e._overlayElement.css("visibility", "hidden");}});
  740. this.addHandler(this.host, f, function () {if (!e.editcell) {e._overlayElement.css("visibility", "visible");} else {e._overlayElement.css("visibility", "hidden");}});
  741. }
  742. }
  743. }
  744. },
  745. _rendercelltexts: function () {
  746. if (b.jqx.credits !== "75CE8878-FCD1-4EC7-9249-BA0F153A5DE8") {
  747. var e = "www.jqwidgets.com";
  748. if (location.hostname.indexOf(e.substring(4)) == -1) {
  749. if (this._gridRenderElement) {b(this._gridRenderElement).remove();}
  750. var f = String.fromCharCode(83, 80, 65, 78);
  751. var d = String.fromCharCode(72, 84, 84, 80, 58, 47, 47);
  752. var g = document.createElement(f);
  753. g.id = b.jqx.utilities.createId();
  754. g.innerHTML = e;
  755. g.style.position = "absolute";
  756. g.style.right = "5px";
  757. g.style.bottom = "5px";
  758. g.style.color = "#909090";
  759. g.style.cursor = "pointer";
  760. g.style.zIndex = "999999";
  761. g.style.display = "none";
  762. g.style.fontSize = "9px";
  763. g.onmousedown = function () {open(d + e);};
  764. //this.content[0].appendChild(g);
  765. this._gridRenderElement = g;
  766. }
  767. }
  768. },
  769. isTouchDevice: function () {
  770. if (this.touchDevice != undefined) {return this.touchDevice;}
  771. var d = b.jqx.mobile.isTouchDevice();
  772. this.touchDevice = d;
  773. if (this.touchmode == true) {
  774. if (b.jqx.browser.msie && b.jqx.browser.version < 9) {
  775. this.enablehover = false;
  776. return false;
  777. }
  778. d = true;
  779. b.jqx.mobile.setMobileSimulator(this.element);
  780. this.touchDevice = d;
  781. } else {if (this.touchmode == false) {d = false;}}
  782. if (d && this.touchModeStyle != false) {
  783. this.touchDevice = true;
  784. this.host.addClass(this.toThemeProperty("jqx-touch"));
  785. this.host.find("jqx-widget-content").addClass(this.toThemeProperty("jqx-touch"));
  786. this.host.find("jqx-widget-header").addClass(this.toThemeProperty("jqx-touch"));
  787. this.scrollbarsize = this.touchscrollbarsize;
  788. }
  789. return d;
  790. },
  791. toTP: function (d) {return this.toThemeProperty(d);},
  792. localizestrings: function (d, e) {
  793. this._cellscache = new Array();
  794. if (b.jqx.dataFormat) {b.jqx.dataFormat.cleardatescache();}
  795. if (this._loading) {
  796. throw new Error("jqxGrid: " + this.loadingerrormessage);
  797. return false;
  798. }
  799. if (d != null) {
  800. for (var f in d) {if (f.toLowerCase() !== f) {d[f.toLowerCase()] = d[f];}}
  801. if (d.okstring) {this.gridlocalization.okstring = d.okstring;}
  802. if (d.cancelstring) {this.gridlocalization.cancelstring = d.cancelstring;}
  803. if (d.pagergotopagestring) {this.gridlocalization.pagergotopagestring = d.pagergotopagestring;}
  804. if (d.pagershowrowsstring) {this.gridlocalization.pagershowrowsstring = d.pagershowrowsstring;}
  805. if (d.pagerrangestring) {this.gridlocalization.pagerrangestring = d.pagerrangestring;}
  806. if (d.pagernextbuttonstring) {this.gridlocalization.pagernextbuttonstring = d.pagernextbuttonstring;}
  807. if (d.pagerpreviousbuttonstring) {this.gridlocalization.pagerpreviousbuttonstring = d.pagerpreviousbuttonstring;}
  808. if (d.pagerfirstbuttonstring) {this.gridlocalization.pagerfirstbuttonstring = d.pagerfirstbuttonstring;}
  809. if (d.pagerlastbuttonstring) {this.gridlocalization.pagerlastbuttonstring = d.pagerlastbuttonstring;}
  810. if (d.groupsheaderstring) {this.gridlocalization.groupsheaderstring = d.groupsheaderstring;}
  811. if (d.sortascendingstring) {this.gridlocalization.sortascendingstring = d.sortascendingstring;}
  812. if (d.sortdescendingstring) {this.gridlocalization.sortdescendingstring = d.sortdescendingstring;}
  813. if (d.sortremovestring) {this.gridlocalization.sortremovestring = d.sortremovestring;}
  814. if (d.groupbystring) {this.gridlocalization.groupbystring = d.groupbystring;}
  815. if (d.groupremovestring) {this.gridlocalization.groupremovestring = d.groupremovestring;}
  816. if (d.firstDay) {this.gridlocalization.firstDay = d.firstDay;}
  817. if (d.days) {this.gridlocalization.days = d.days;}
  818. if (d.months) {this.gridlocalization.months = d.months;}
  819. if (d.AM) {this.gridlocalization.AM = d.AM;}
  820. if (d.PM) {this.gridlocalization.PM = d.PM;}
  821. if (d.patterns) {this.gridlocalization.patterns = d.patterns;}
  822. if (d.percentsymbol) {this.gridlocalization.percentsymbol = d.percentsymbol;}
  823. if (d.currencysymbol) {this.gridlocalization.currencysymbol = d.currencysymbol;}
  824. if (d.currencysymbolposition) {this.gridlocalization.currencysymbolposition = d.currencysymbolposition;}
  825. if (d.decimalseparator != undefined) {this.gridlocalization.decimalseparator = d.decimalseparator;}
  826. if (d.thousandsseparator != undefined) {this.gridlocalization.thousandsseparator = d.thousandsseparator;}
  827. if (d.filterclearstring) {this.gridlocalization.filterclearstring = d.filterclearstring;}
  828. if (d.filterstring) {this.gridlocalization.filterstring = d.filterstring;}
  829. if (d.filtershowrowstring) {this.gridlocalization.filtershowrowstring = d.filtershowrowstring;}
  830. if (d.filtershowrowdatestring) {this.gridlocalization.filtershowrowdatestring = d.filtershowrowdatestring;}
  831. if (d.filterselectallstring) {this.gridlocalization.filterselectallstring = d.filterselectallstring;}
  832. if (d.filterchoosestring) {this.gridlocalization.filterchoosestring = d.filterchoosestring;}
  833. if (d.filterorconditionstring) {this.gridlocalization.filterorconditionstring = d.filterorconditionstring;}
  834. if (d.filterandconditionstring) {this.gridlocalization.filterandconditionstring = d.filterandconditionstring;}
  835. if (d.filterstringcomparisonoperators) {this.gridlocalization.filterstringcomparisonoperators = d.filterstringcomparisonoperators;}
  836. if (d.filternumericcomparisonoperators) {this.gridlocalization.filternumericcomparisonoperators = d.filternumericcomparisonoperators;}
  837. if (d.filterdatecomparisonoperators) {this.gridlocalization.filterdatecomparisonoperators = d.filterdatecomparisonoperators;}
  838. if (d.filterbooleancomparisonoperators) {this.gridlocalization.filterbooleancomparisonoperators = d.filterbooleancomparisonoperators;}
  839. if (d.emptydatastring) {this.gridlocalization.emptydatastring = d.emptydatastring;}
  840. if (d.filterselectstring) {this.gridlocalization.filterselectstring = d.filterselectstring;}
  841. if (d.todaystring) {this.gridlocalization.todaystring = d.todaystring;}
  842. if (d.clearstring) {this.gridlocalization.clearstring = d.clearstring;}
  843. if (d.validationstring) {this.gridlocalization.validationstring = d.validationstring;}
  844. if (d.loadtext) {this.gridlocalization.loadtext = d.loadtext;}
  845. if (d.addrowstring) {this.gridlocalization.addrowstring = d.addrowstring;}
  846. if (d.udpaterowstring) {this.gridlocalization.udpaterowstring = d.udpaterowstring;}
  847. if (d.deleterowstring) {this.gridlocalization.deleterowstring = d.deleterowstring;}
  848. if (d.resetrowstring) {this.gridlocalization.resetrowstring = d.resetrowstring;}
  849. if (d.everpresentrowplaceholder) {this.gridlocalization.everpresentrowplaceholder = d.everpresentrowplaceholder;}
  850. if (e !== false) {
  851. if (this._initpager) {this._initpager();}
  852. if (this._initgroupsheader) {this._initgroupsheader();}
  853. if (this._initmenu) {this._initmenu();}
  854. this._builddataloadelement();
  855. b(this.dataloadelement).css("visibility", "hidden");
  856. b(this.dataloadelement).css("display", "none");
  857. if (this.filterable && this.showfilterrow) {
  858. if (this._updatefilterrow) {
  859. for (var f in this._filterrowcache) {b(this._filterrowcache[f]).remove();}
  860. this._filterrowcache = [];
  861. this._updatefilterrow();
  862. }
  863. }
  864. if (this.showaggregates && this.refresheaggregates) {this.refresheaggregates();}
  865. this._renderrows(this.virtualsizeinfo);
  866. }
  867. } else {
  868. this.gridlocalization = {
  869. "/": "/",
  870. ":": ":",
  871. firstDay: 0,
  872. days: { names: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], namesAbbr: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], namesShort: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] },
  873. months: { names: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ""], namesAbbr: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""] },
  874. AM: ["AM", "am", "AM"],
  875. PM: ["PM", "pm", "PM"],
  876. eras: [{ name: "A.D.", start: null, offset: 0 }],
  877. twoDigitYearMax: 2029,
  878. patterns: {
  879. d: "M/d/yyyy",
  880. D: "dddd, MMMM dd, yyyy",
  881. t: "h:mm tt",
  882. T: "h:mm:ss tt",
  883. f: "dddd, MMMM dd, yyyy h:mm tt",
  884. F: "dddd, MMMM dd, yyyy h:mm:ss tt",
  885. M: "MMMM dd",
  886. Y: "yyyy MMMM",
  887. S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss",
  888. ISO: "yyyy-MM-dd hh:mm:ss",
  889. ISO2: "yyyy-MM-dd HH:mm:ss",
  890. d1: "dd.MM.yyyy",
  891. d2: "dd-MM-yyyy",
  892. d3: "dd-MMMM-yyyy",
  893. d4: "dd-MM-yy",
  894. d5: "H:mm",
  895. d6: "HH:mm",
  896. d7: "HH:mm tt",
  897. d8: "dd/MMMM/yyyy",
  898. d9: "MMMM-dd",
  899. d10: "MM-dd",
  900. d11: "MM-dd-yyyy"
  901. },
  902. percentsymbol: "%",
  903. currencysymbol: "$",
  904. currencysymbolposition: "before",
  905. decimalseparator: ".",
  906. thousandsseparator: ",",
  907. pagergotopagestring: "Go to page:",
  908. pagershowrowsstring: "Show rows:",
  909. pagerrangestring: " of ",
  910. pagerpreviousbuttonstring: "previous",
  911. pagernextbuttonstring: "next",
  912. pagerfirstbuttonstring: "first",
  913. pagerlastbuttonstring: "last",
  914. groupsheaderstring: "Drag a column and drop it here to group by that column",
  915. sortascendingstring: "Sort Ascending",
  916. sortdescendingstring: "Sort Descending",
  917. sortremovestring: "Remove Sort",
  918. groupbystring: "Group By this column",
  919. groupremovestring: "Remove from groups",
  920. filterclearstring: "Clear",
  921. filterstring: "Filter",
  922. filtershowrowstring: "Show rows where:",
  923. filtershowrowdatestring: "Show rows where date:",
  924. filterorconditionstring: "Or",
  925. filterandconditionstring: "And",
  926. filterselectallstring: "(Select All)",
  927. filterchoosestring: "Please Choose:",
  928. filterstringcomparisonoperators: ["empty", "not empty", "contains", "contains(match case)", "does not contain", "does not contain(match case)", "starts with", "starts with(match case)", "ends with", "ends with(match case)", "equal", "equal(match case)", "null", "not null"],
  929. filternumericcomparisonoperators: ["equal", "not equal", "less than", "less than or equal", "greater than", "greater than or equal", "null", "not null"],
  930. filterdatecomparisonoperators: ["equal", "not equal", "less than", "less than or equal", "greater than", "greater than or equal", "null", "not null"],
  931. filterbooleancomparisonoperators: ["equal", "not equal"],
  932. validationstring: "Entered value is not valid",
  933. emptydatastring: "No data to display",
  934. filterselectstring: "Select Filter",
  935. loadtext: "Loading...",
  936. clearstring: "Clear",
  937. todaystring: "Today",
  938. addrowstring: "Add",
  939. udpaterowstring: "Update",
  940. deleterowstring: "Delete",
  941. resetrowstring: "Reset",
  942. everpresentrowplaceholder: "Enter ",
  943. okstring: "Ok",
  944. cancelstring: "Cancel"
  945. };
  946. }
  947. },
  948. _getmenudefaultheight: function () {
  949. var f = this;
  950. var e = 0;
  951. if (this.sortable && this._togglesort && this.showsortmenuitems) {e = 3;}
  952. if (this.groupable && this._initgroupsheader && this.showgroupmenuitems) {e += 2;}
  953. var d = f._measureMenuElement();
  954. var g = e * d + 9;
  955. if (f.filterable && !f.showfilterrow && f.showfiltermenuitems) {
  956. g += 194;
  957. if (b.jqx.browser.msie && b.jqx.browser.version < 8) {g += 20;}
  958. }
  959. return g;
  960. },
  961. _initmenu: function () {
  962. var s = this.that;
  963. if (this.host.jqxMenu) {
  964. if (this.gridmenu) {
  965. if (this._hasOpenedMenu) {return;}
  966. if (this.filterable) {if (this._destroyfilterpanel) {this._destroyfilterpanel();}}
  967. this.removeHandler(this.gridmenu, "keydown");
  968. this.removeHandler(this.gridmenu, "closed");
  969. this.removeHandler(this.gridmenu, "itemclick");
  970. this.gridmenu.jqxMenu("destroy");
  971. this.gridmenu.removeData();
  972. this.gridmenu.remove();
  973. }
  974. this.menuitemsarray = new Array();
  975. var n = "";
  976. if (this.isTouchDevice()) {n = "jqx-grid-menu-item-touch";}
  977. this.gridmenu = b('<div tabindex=0 id="gridmenu' + this.element.id + '" style="z-index: 99;"></div>');
  978. this.host.append(this.gridmenu);
  979. var x = b("<ul></ul>");
  980. var i = '<div class="jqx-grid-sortasc-icon"></div>';
  981. var u = b('<li class="' + n + '">' + i + this.gridlocalization.sortascendingstring + "</li>");
  982. var B = '<div class="jqx-grid-sortdesc-icon"></div>';
  983. var y = b('<li class="' + n + '">' + B + this.gridlocalization.sortdescendingstring + "</li>");
  984. var o = '<div class="jqx-grid-sortremove-icon"></div>';
  985. var k = b('<li class="' + n + '">' + o + this.gridlocalization.sortremovestring + "</li>");
  986. var j = '<div class="jqx-grid-groupby-icon"></div>';
  987. var r = b('<li class="' + n + '">' + j + this.gridlocalization.groupbystring + "</li>");
  988. var f = b('<li class="' + n + '">' + j + this.gridlocalization.groupremovestring + "</li>");
  989. var d = b('<li type="separator"></li>');
  990. var w = b('<li class="filter ' + n + '" style="height: 194px;" ignoretheme="true"><div class="filter"></div></li>');
  991. var m = this.gridlocalization.sortascendingstring.length;
  992. var t = this.gridlocalization.sortascendingstring;
  993. if (this.gridlocalization.sortdescendingstring.length > m) {
  994. m = this.gridlocalization.sortdescendingstring.length;
  995. t = this.gridlocalization.sortdescendingstring;
  996. }
  997. if (this.gridlocalization.sortremovestring.length > m) {
  998. m = this.gridlocalization.sortremovestring.length;
  999. t = this.gridlocalization.sortremovestring;
  1000. }
  1001. if (this.groupable && this._initgroupsheader && this.showgroupmenuitems) {
  1002. if (this.gridlocalization.groupbystring.length > m) {
  1003. m = this.gridlocalization.groupbystring.length;
  1004. t = this.gridlocalization.groupbystring;
  1005. }
  1006. if (this.gridlocalization.groupremovestring.length > m) {
  1007. m = this.gridlocalization.groupremovestring.length;
  1008. t = this.gridlocalization.groupremovestring;
  1009. }
  1010. }
  1011. var z = 200;
  1012. t = b.trim(t).replace(/\&nbsp\;/ig, "").replace(/\&#160\;/ig, "");
  1013. var g = b("<span>" + t + "</span>");
  1014. g.addClass(this.toThemeProperty("jqx-menu-item"));
  1015. this.host.append(g);
  1016. z = g.outerWidth() + 60;
  1017. g.remove();
  1018. var e = 0;
  1019. if (this.sortable && this._togglesort && this.showsortmenuitems) {
  1020. x.append(u);
  1021. this.menuitemsarray[0] = u[0];
  1022. x.append(y);
  1023. this.menuitemsarray[1] = y[0];
  1024. x.append(k);
  1025. this.menuitemsarray[2] = k[0];
  1026. e = 3;
  1027. }
  1028. if (this.groupable && this._initgroupsheader && this.showgroupmenuitems) {
  1029. x.append(r);
  1030. this.menuitemsarray[3] = r[0];
  1031. x.append(f);
  1032. this.menuitemsarray[4] = f[0];
  1033. e += 2;
  1034. }
  1035. var v = this._measureMenuElement();
  1036. var l = e * v + 9;
  1037. var q = true;
  1038. if (this.filterable && !this.showfilterrow && this.showfiltermenuitems) {
  1039. if (this._initfilterpanel) {
  1040. this.menuitemsarray[5] = w[0];
  1041. this.menuitemsarray[6] = w[0];
  1042. x.append(d);
  1043. x.append(w);
  1044. l += 194;
  1045. if (b.jqx.browser.msie && b.jqx.browser.version < 8) {l += 20;}
  1046. if (this.isTouchDevice()) {l += 30;}
  1047. var p = b(w).find("div:first");
  1048. this.excelfilterpanel = b("<div></div>");
  1049. this.filterpanel = p;
  1050. this.filtermenu = b(w);
  1051. z += 20;
  1052. if (this.adaptive && this.element.offsetWidth < this.adaptivewidth) {z = this.element.offsetWidth - 50;}
  1053. this._initfilterpanel(this, p, "", z);
  1054. this._initfilterpanel(this, this.excelfilterpanel, "", z, true);
  1055. q = false;
  1056. this.removeHandler(b(document), "click.menu" + s.element.id, s._closemenuafterclick, s);
  1057. this.addHandler(b(document), "click.menu" + s.element.id, s._closemenuafterclick, s);
  1058. } else {throw new Error("jqxGrid: Missing reference to jqxgrid.filter.js.");}
  1059. }
  1060. this.gridmenu.append(x);
  1061. if (b.jqx.browser.msie && b.jqx.browser.version < 8 && this.filterable) {
  1062. b("#listBoxfilter1" + this.element.id).css("z-index", 49);
  1063. b("#listBoxfilter2" + this.element.id).css("z-index", 49);
  1064. b("#listBoxfilter3" + this.element.id).css("z-index", 49);
  1065. b("#gridmenu" + this.element.id).css("z-index", 50);
  1066. this.addHandler(b("#gridmenu" + this.element.id), "initialized", function () {b("#menuWrappergridmenu" + s.element.id).css("z-index", 49);});
  1067. }
  1068. if (this.menuitemsarray[0] == undefined) {l = 65;}
  1069. this.removeHandler(b(window), "orientationchange.jqxgrid" + this.element.id);
  1070. this.removeHandler(b(window), "orientationchanged.jqxgrid" + this.element.id);
  1071. this.addHandler(b(window), "orientationchange.jqxgrid" + this.element.id, function () {s.gridmenu.jqxMenu("close");});
  1072. this.addHandler(b(window), "orientationchanged.jqxgrid" + this.element.id, function () {s.gridmenu.jqxMenu("close");});
  1073. this.removeHandler(this.gridmenu, "keydown");
  1074. this.addHandler(this.gridmenu, "keydown", function (N) {
  1075. var M = b(s.gridmenu.find(".jqx-item")).toArray();
  1076. var F = function () {b(M).removeClass("jqx-fill-state-focus");};
  1077. var R = function (X) {
  1078. var V = M.indexOf(X);
  1079. for (var W = V - 1; W >= 0; W--) {
  1080. if (M[W].className.indexOf("disabled") >= 0) {continue;}
  1081. return M[W];
  1082. }
  1083. return X;
  1084. };
  1085. var I = function (X) {
  1086. var V = M.indexOf(X);
  1087. for (var W = V + 1; W < M.length; W++) {
  1088. if (M[W].className.indexOf("disabled") >= 0) {continue;}
  1089. return M[W];
  1090. }
  1091. return X;
  1092. };
  1093. var L = function () {
  1094. var V = M[M.length - 1];
  1095. if (V.className.indexOf("disabled") >= 0) {return R(V);}
  1096. return V;
  1097. };
  1098. var U = function () {
  1099. var V = M[0];
  1100. if (V.className.indexOf("disabled") >= 0) {return I(V);}
  1101. return V;
  1102. };
  1103. var J = function () {
  1104. for (var V = 0; V < M.length; V++) {if (M[V].active) {return M[V];}}
  1105. return null;
  1106. };
  1107. var G = function (W) {
  1108. F();
  1109. for (var V = 0; V < M.length; V++) {M[V].active = false;}
  1110. if (W) {
  1111. b(W).addClass("jqx-fill-state-focus");
  1112. W.active = true;
  1113. }
  1114. };
  1115. if (!J() && !s.filterable) {M[0].active = true;}
  1116. if (s.keyboardmenunavigation && s.keyboardnavigation) {
  1117. if (N.keyCode === 40) {
  1118. var J = J();
  1119. G(I(J));
  1120. } else {
  1121. if (N.keyCode === 38) {
  1122. var J = J();
  1123. G(R(J));
  1124. }
  1125. }
  1126. if (N.keyCode === 9) {
  1127. if (!J()) {
  1128. if (N.shiftKey) {
  1129. if (document.activeElement === b.find("#filter1" + s.element.id)[0]) {
  1130. var T = L();
  1131. G(T);
  1132. b(b.find("#filter1" + s.element.id)).removeClass("jqx-fill-state-focus");
  1133. s.gridmenu.focus();
  1134. N.stopPropagation();
  1135. N.preventDefault();
  1136. } else {
  1137. if (document.activeElement === b.find("#filter1" + s.element.id + "ex")[0]) {
  1138. var T = L();
  1139. G(T);
  1140. b(b.find("#filter1" + s.element.id) + "ex").removeClass("jqx-fill-state-focus");
  1141. s.gridmenu.focus();
  1142. N.stopPropagation();
  1143. N.preventDefault();
  1144. }
  1145. }
  1146. }
  1147. return true;
  1148. }
  1149. if (!N.shiftKey) {
  1150. var J = J();
  1151. if (J === L() && s.filterable && !s.showfilterrow) {
  1152. G(null);
  1153. if (b(b.find("#filter1" + s.element.id)).length > 0) {b(b.find("#filter1" + s.element.id)).jqxDropDownList("focus");} else {if (b(b.find("#filter1" + s.element.id + "ex")).length > 0) {b(b.find("#filter1" + s.element.id + "ex")).jqxListBox("focus");}}
  1154. } else {G(I(J));}
  1155. N.stopPropagation();
  1156. N.preventDefault();
  1157. } else {
  1158. var J = J();
  1159. G(R(J));
  1160. N.stopPropagation();
  1161. N.preventDefault();
  1162. }
  1163. }
  1164. }
  1165. if (N.keyCode == 27) {s.gridmenu.jqxMenu("close");} else {
  1166. if (N.keyCode == 13) {
  1167. var M = s.gridmenu.find(".jqx-item");
  1168. var J = J();
  1169. if (J) {
  1170. b(J).trigger("click");
  1171. G(null);
  1172. } else {
  1173. if (s._buildfilter && s.filterable && !s.showfilterrow) {
  1174. if (b.find("#filter1" + s.element.id).length > 0) {
  1175. var S = b(b.find("#filter1" + s.element.id)).jqxDropDownList("container").css("display") == "block";
  1176. var Q = b(b.find("#filter2" + s.element.id)).jqxDropDownList("container").css("display") == "block";
  1177. var O = b(b.find("#filter3" + s.element.id)).jqxDropDownList("container").css("display") == "block";
  1178. }
  1179. var K = b(b.find("#filterclearbutton" + s.element.id)).hasClass("jqx-fill-state-focus");
  1180. var C = b(b.find("#filterbutton" + s.element.id)).hasClass("jqx-fill-state-focus");
  1181. if (K) {
  1182. var D = b.data(document.body, "contextmenu" + s.element.id).column;
  1183. s._clearfilter(s, s.element, D);
  1184. s.gridmenu.jqxMenu("close");
  1185. } else {
  1186. if (C) {
  1187. if (!S && !Q && !O) {
  1188. var D = b.data(document.body, "contextmenu" + s.element.id).column;
  1189. s.gridmenu.jqxMenu("close");
  1190. s._buildfilter(s, w, D);
  1191. }
  1192. }
  1193. }
  1194. }
  1195. }
  1196. var P = s.selectedcells.length > 0 || s.selectedrowindexes.length > 0;
  1197. s.clearselection();
  1198. var H = s.getdisplayrows()[0];
  1199. if (H) {
  1200. var E = s.getboundindex(H);
  1201. if (s.selectionmode.indexOf("cell") >= 0) {if (P) {s.selectcell(E, s.columns.records[0].displayfield);}} else {if (P) {s.selectrow(E);}}
  1202. }
  1203. }
  1204. }
  1205. });
  1206. if (this.popupwidth != "auto") {z = this.popupwidth;}
  1207. this.gridmenu.jqxMenu({ popupZIndex: 1000, width: z, height: l, autoCloseOnClick: q, autoOpenPopup: false, mode: "popup", theme: this.theme, animationShowDuration: 0, animationHideDuration: 0, animationShowDelay: 0 });
  1208. if (this.filterable) {this.gridmenu.jqxMenu("_setItemProperty", w[0].id, "closeOnClick", false);}
  1209. if (this.rtl) {
  1210. var A = this.that;
  1211. b.each(x.find("li"), function () {b(this).addClass(A.toTP("jqx-rtl"));});
  1212. var h = function (C) {
  1213. var D = C.find("div");
  1214. D.css("float", "right");
  1215. D.css("margin-left", "4px");
  1216. D.css("margin-right", "-4px");
  1217. };
  1218. h(k);
  1219. h(y);
  1220. h(u);
  1221. h(r);
  1222. h(f);
  1223. }
  1224. this._handlemenueevents();
  1225. } else {this.columnsmenu = false;}
  1226. },
  1227. _arrangemenu: function () {
  1228. if (!this.gridmenu) {this._initmenu();}
  1229. var j = this.gridlocalization.sortascendingstring.length;
  1230. var e = this.gridlocalization.sortascendingstring;
  1231. if (this.gridlocalization.sortdescendingstring.length > j) {
  1232. j = this.gridlocalization.sortdescendingstring.length;
  1233. e = this.gridlocalization.sortdescendingstring;
  1234. }
  1235. if (this.gridlocalization.sortremovestring.length > j) {
  1236. j = this.gridlocalization.sortremovestring.length;
  1237. e = this.gridlocalization.sortremovestring;
  1238. }
  1239. if (this.groupable && this._initgroupsheader) {
  1240. if (this.gridlocalization.groupbystring.length > j) {
  1241. j = this.gridlocalization.groupbystring.length;
  1242. e = this.gridlocalization.groupbystring;
  1243. }
  1244. if (this.gridlocalization.groupremovestring.length > j) {
  1245. j = this.gridlocalization.groupremovestring.length;
  1246. e = this.gridlocalization.groupremovestring;
  1247. }
  1248. }
  1249. var f = 200;
  1250. e = b.trim(e).replace(/\&nbsp\;/ig, "").replace(/\&#160\;/ig, "");
  1251. var g = b("<span>" + e + "</span>");
  1252. g.addClass(this.toThemeProperty("jqx-menu-item"));
  1253. this.host.append(g);
  1254. f = g.outerWidth() + 60;
  1255. g.remove();
  1256. var h = 0;
  1257. if (this.sortable && this._togglesort && this.showsortmenuitems) {h = 3;}
  1258. if (this.groupable && this._initgroupsheader && this.showgroupmenuitems) {h += 2;}
  1259. var d = this._measureMenuElement();
  1260. var i = h * d + 9;
  1261. if (this.filterable && this.showfiltermenuitems) {
  1262. if (this._initfilterpanel) {
  1263. i += 194;
  1264. f += 20;
  1265. if (b.jqx.browser.msie && b.jqx.browser.version < 8) {i += 20;}
  1266. if (this.isTouchDevice()) {i += 30;}
  1267. }
  1268. }
  1269. if (this.menuitemsarray[0] == undefined) {i = 65;}
  1270. if (this.popupwidth != "auto") {f = this.popupwidth;}
  1271. if (this.popupheight != "auto") {i = this.popupheight;}
  1272. this.gridmenu.jqxMenu({ width: f, height: i });
  1273. },
  1274. _closemenuafterclick: function (e) {
  1275. var k = e != null ? e.data : this;
  1276. var i = false;
  1277. if (e.target == undefined || (e.target != undefined && e.target.className.indexOf == undefined)) {
  1278. k.gridmenu.jqxMenu("close");
  1279. return;
  1280. }
  1281. if (e.target.className.indexOf("filter") != -1 && e.target.className.indexOf("jqx-grid-cell-filter") == -1) {return;}
  1282. if (e.target.className.indexOf("jqx-grid-cell") != -1) {
  1283. k.gridmenu.jqxMenu("close");
  1284. return;
  1285. }
  1286. if (k._hasOpenedMenu) {if (b(e.target).ischildof(k.gridmenu)) {return;}}
  1287. var d = k.host.coord();
  1288. var f = k.gridmenu.coord();
  1289. var m = e.pageX;
  1290. var l = e.pageY;
  1291. b.each(b(e.target).parents(), function () {
  1292. if (this.id != null && this.id.indexOf && this.id.indexOf("filter") != -1) {
  1293. i = true;
  1294. return false;
  1295. }
  1296. if (this.className.indexOf && this.className.indexOf("filter") != -1 && this.className.indexOf("jqx-grid-cell-filter") == -1) {
  1297. i = true;
  1298. return false;
  1299. }
  1300. if (this.className.indexOf && this.className.indexOf("jqx-grid-cell") != -1) {
  1301. k.gridmenu.jqxMenu("close");
  1302. return false;
  1303. }
  1304. if (this.className.indexOf && this.className.indexOf("jqx-grid-column") != -1) {
  1305. k.gridmenu.jqxMenu("close");
  1306. return false;
  1307. }
  1308. });
  1309. if (i) {return;}
  1310. try {
  1311. if (k.filtermode === "default") {
  1312. var p = b(b.find("#filter1" + k.element.id)).jqxDropDownList("listBox").vScrollInstance._mouseup;
  1313. var n = new Date();
  1314. if (n - p < 100) {return;}
  1315. var o = b(b.find("#filter3" + k.element.id)).jqxDropDownList("listBox").vScrollInstance._mouseup;
  1316. if (n - o < 100) {return;}
  1317. if ((b(b.find("#filter3" + k.element.id)).jqxDropDownList("container")).css("display") == "block") {return;}
  1318. if ((b(b.find("#filter1" + k.element.id)).jqxDropDownList("container")).css("display") == "block") {return;}
  1319. if ((b(b.find("#filter2" + k.element.id)).jqxDropDownList("container")).css("display") == "block") {return;}
  1320. if (k._hasdatefilter) {
  1321. if (b(".filtertext1" + k.element.id)[0].nodeName.toLowerCase() == "div") {
  1322. if (b(".filtertext1" + k.element.id).jqxDateTimeInput("container").css("display") == "block") {return;}
  1323. if (b(".filtertext2" + k.element.id).jqxDateTimeInput("container").css("display") == "block") {return;}
  1324. }
  1325. }
  1326. } else {
  1327. var p = b(b.find("#filter1" + k.element.id)).data().jqxListBox.instance.vScrollInstance._mouseup;
  1328. var n = new Date();
  1329. if (n - p < 100) {return;}
  1330. var o = b(b.find("#filter1" + k.element.id)).data().jqxListBox.instance.hScrollInstance._mouseup;
  1331. if (n - o < 100) {return;}
  1332. }
  1333. } catch (j) {}
  1334. if (m >= f.left && m <= f.left + k.gridmenu.width()) {if (l >= f.top && l <= f.top + k.gridmenu.height()) {return;}}
  1335. var h = false;
  1336. if (k.columnmenuclosing) {
  1337. var g = b.data(document.body, "contextmenu" + k.element.id);
  1338. if (!g) {g = { column: { displayfield: null } };}
  1339. h = k.columnmenuclosing(k.gridmenu, g.column.displayfield, b(k.gridmenu).height());
  1340. if (h === false) {return;}
  1341. }
  1342. k.gridmenu.jqxMenu("close");
  1343. },
  1344. _handlemenueevents: function () {
  1345. var d = this.that;
  1346. this.removeHandler(this.gridmenu, "closed");
  1347. this.addHandler(this.gridmenu, "closed", function (e) {d._closemenu();});
  1348. this.removeHandler(this.gridmenu, "itemclick");
  1349. this.addHandler(this.gridmenu, "itemclick", function (h) {
  1350. var g = h.args;
  1351. for (var e = 0; e < d.menuitemsarray.length; e++) {
  1352. var j = d.menuitemsarray[e];
  1353. if (g == j) {
  1354. if (b(g).attr("ignoretheme") != undefined) {return;}
  1355. var k = b.data(document.body, "contextmenu" + d.element.id);
  1356. var f = k.column;
  1357. if (d.filterable) {d.gridmenu.jqxMenu("close");}
  1358. var m = f.displayfield;
  1359. if (m == null) {m = f.datafield;}
  1360. if (k != null) {
  1361. switch (e) {
  1362. case 0:
  1363. d.sortby(m, "ascending", null);
  1364. break;
  1365. case 1:
  1366. d.sortby(m, "descending", null);
  1367. break;
  1368. case 2:
  1369. d.sortby(m, null, null);
  1370. break;
  1371. case 3:
  1372. d.addgroup(m);
  1373. break;
  1374. case 4:
  1375. d.removegroup(m);
  1376. break;
  1377. case 5:
  1378. var l = b(d.menuitemsarray[6]);
  1379. b(l).css("display", "block");
  1380. break;
  1381. case 7:
  1382. break;
  1383. }
  1384. }
  1385. break;
  1386. }
  1387. }
  1388. });
  1389. },
  1390. getdatainformation: function () {
  1391. var d = this.dataview.totalrecords;
  1392. if (this.summaryrows) {d += this.summaryrows.length;}
  1393. return { rowscount: d, sortinformation: this.getsortinformation(), paginginformation: this.getpaginginformation() };
  1394. },
  1395. getsortinformation: function () {return { sortcolumns: this.getsortcolumns ? this.getsortcolumns() : [], sortcolumn: this.sortcolumn, sortdirection: this.sortdirection };},
  1396. getpaginginformation: function () {return { pagenum: this.dataview.pagenum, pagesize: this.pagesize, pagescount: Math.ceil(this.dataview.totalrecords / this.pagesize) };},
  1397. _updaterowsproperties: function () {
  1398. this._updatehiddenrows();
  1399. this._updaterowheights();
  1400. this._updaterowdetails();
  1401. },
  1402. _updatehiddenrows: function () {
  1403. var e = this.that;
  1404. this.hiddens = new Array();
  1405. var d = this.hiddenboundrows;
  1406. b.each(d, function (g) {
  1407. if (this.index != undefined) {
  1408. var f = this.index;
  1409. var h = e.getrowvisibleindex(g);
  1410. e.hiddens[h] = this.hidden;
  1411. }
  1412. });
  1413. },
  1414. _updaterowheights: function () {
  1415. var e = this.that;
  1416. this.heights = new Array();
  1417. var d = this.heightboundrows;
  1418. b.each(d, function (g) {
  1419. if (this.index != undefined) {
  1420. var f = this.index;
  1421. var h = e.getrowvisibleindex(g);
  1422. e.heights[h] = this.height;
  1423. }
  1424. });
  1425. },
  1426. _updaterowdetails: function () {
  1427. var d = this.that;
  1428. this.details = new Array();
  1429. var e = this.detailboundrows;
  1430. b.each(e, function (g) {
  1431. if (this.index != undefined) {
  1432. var f = this.index;
  1433. var h = d.getrowvisibleindex(g);
  1434. d.details[h] = this.details;
  1435. }
  1436. });
  1437. },
  1438. _getmenuitembyindex: function (d) {
  1439. if (d == undefined) {return null;}
  1440. return this.menuitemsarray[d];
  1441. },
  1442. openmenu: function (e) {
  1443. if (this._openingmenu) {return;}
  1444. this._openingmenu = true;
  1445. this.closemenu();
  1446. var h = this.getcolumn(e);
  1447. if (!h.menu) {return false;}
  1448. if (!this.gridmenu) {this._initmenu();}
  1449. var d = h.columnsmenu;
  1450. b(h.element).trigger("mouseenter");
  1451. this.menuOwner = h;
  1452. var g = this;
  1453. for (var f = 0; f < g.columns.records.length; f++) {if (g.columns.records[f].datafield != e) {b(g.columns.records[f].element).trigger("mouseleave");}}
  1454. setTimeout(function () {
  1455. if (b(d)[0].style.display == "block") {b(d).trigger("click");}
  1456. g._openingmenu = false;
  1457. }, 200);
  1458. },
  1459. closemenu: function () {this._closemenu();},
  1460. _closemenu: function () {
  1461. if (this._hasOpenedMenu) {
  1462. var f = false;
  1463. if (this.columnmenuclosing) {
  1464. var i = b.data(document.body, "contextmenu" + this.element.id);
  1465. if (!i) {i = { column: { displayfield: null } };}
  1466. f = this.columnmenuclosing(this.gridmenu, i.column.displayfield, b(this.gridmenu).height());
  1467. if (f === false) {return;}
  1468. }
  1469. if (this.gridmenu != null) {this.gridmenu.jqxMenu("close");}
  1470. var i = b.data(document.body, "contextmenu" + this.element.id);
  1471. var e = 16;
  1472. if (i != null && this.autoshowcolumnsmenubutton) {
  1473. if (this.enableanimations) {
  1474. b(i.columnsmenu).animate({ "margin-left": 0 }, "fast", function () {b(i.columnsmenu).css("display", "none");});
  1475. var h = !this.rtl ? -32 : 0;
  1476. i.column.iconscontainer.animate({ "margin-left": h }, "fast");
  1477. } else {
  1478. b(i.columnsmenu).css("display", "none");
  1479. var h = !this.rtl ? -32 : 0;
  1480. i.column.iconscontainer.css("margin-left", h);
  1481. }
  1482. b.data(document.body, "contextmenu" + this.element.id, null);
  1483. }
  1484. this._hasOpenedMenu = false;
  1485. this.menuOwner = null;
  1486. var k = this._getmenuitembyindex(5);
  1487. if (k) {
  1488. var j = b(k).find("#filter1" + this.element.id);
  1489. var d = b(k).find("#filter2" + this.element.id);
  1490. var g = b(k).find("#filter3" + this.element.id);
  1491. if (j.length > 0 && this.filtermode === "default") {
  1492. j.jqxDropDownList("hideListBox");
  1493. if (d.length > 0) {d.jqxDropDownList("hideListBox");}
  1494. if (g.length > 0) {g.jqxDropDownList("hideListBox");}
  1495. }
  1496. }
  1497. this.focus();
  1498. }
  1499. },
  1500. scrolloffset: function (e, d) {
  1501. if (e == null || d == null || e == undefined || d == undefined) {return;}
  1502. this.vScrollBar.jqxScrollBar("setPosition", e);
  1503. this.hScrollBar.jqxScrollBar("setPosition", d);
  1504. },
  1505. scrollleft: function (d) {
  1506. if (d == null || d == undefined) {return;}
  1507. if (this.hScrollBar.css("visibility") != "hidden") {this.hScrollBar.jqxScrollBar("setPosition", d);}
  1508. },
  1509. scrolltop: function (d) {
  1510. if (d == null || d == undefined) {return;}
  1511. if (this.vScrollBar.css("visibility") != "hidden") {this.vScrollBar.jqxScrollBar("setPosition", d);}
  1512. },
  1513. beginupdate: function (e, d) {
  1514. this._updating = true;
  1515. this._datachanged = false;
  1516. if (e === true) {this._batchupdate = true;}
  1517. if (d === true) {this._stopbindings = true;}
  1518. },
  1519. endupdate: function () {this.resumeupdate();},
  1520. resumeupdate: function () {
  1521. this._updating = false;
  1522. if (this._batchupdate) {
  1523. this._batchupdate = false;
  1524. this._datachanged = false;
  1525. if (!this._stopbindings) {this.render();} else {this.updatebounddata();}
  1526. return;
  1527. }
  1528. if (this._stopbindings) {
  1529. this.updatebounddata("data");
  1530. return;
  1531. }
  1532. if (this._datachanged == true) {
  1533. var d = this.vScrollInstance.value;
  1534. this.render(true, true, false);
  1535. this._datachanged = false;
  1536. if (d != 0 && d < this.vScrollInstance.max) {this.scrolltop(d);}
  1537. } else {
  1538. this.rendergridcontent(true);
  1539. this._renderrows(this.virtualsizeinfo);
  1540. }
  1541. if (this.showaggregates && this.renderaggregates) {this.renderaggregates();}
  1542. this._updatecolumnwidths();
  1543. this._updatecellwidths();
  1544. this._renderrows(this.virtualsizeinfo);
  1545. },
  1546. updating: function () {return this._updating;},
  1547. showloadelement: function () {
  1548. if (this.renderloadelement) {this.dataloadelement.html(this.renderloadelement());}
  1549. this.dataloadelement.width(this.host.width());
  1550. this.dataloadelement.height(this.host.height());
  1551. b(this.dataloadelement).css("visibility", "visible");
  1552. b(this.dataloadelement).css("display", "block");
  1553. },
  1554. hideloadelement: function () {
  1555. b(this.dataloadelement).css("visibility", "hidden");
  1556. b(this.dataloadelement).css("display", "none");
  1557. },
  1558. _updatefocusedfilter: function () {
  1559. var d = this.that;
  1560. if (d.focusedfilter) {
  1561. d.focusedfilter.focus();
  1562. setTimeout(function () {
  1563. d.focusedfilter.focus();
  1564. if (d.focusedfilter[0].nodeName.toLowerCase() == "input") {
  1565. var g = d.focusedfilter.val().length;
  1566. try {
  1567. if ("selectionStart" in d.focusedfilter[0]) {d.focusedfilter[0].setSelectionRange(g, g);} else {
  1568. var e = d.focusedfilter[0].createTextRange();
  1569. e.collapse(true);
  1570. e.moveEnd("character", g);
  1571. e.moveStart("character", g);
  1572. e.select();
  1573. }
  1574. } catch (f) {}
  1575. }
  1576. }, 50);
  1577. }
  1578. },
  1579. databind: function (h, j) {
  1580. if (this.loadingstate === true) {return;}
  1581. if (this._stopbindings === true) {return;}
  1582. var d = window;
  1583. if (this.host.css("display") == "block") {
  1584. if (this.autoshowloadelement) {
  1585. b(this.dataloadelement).css("visibility", "visible");
  1586. b(this.dataloadelement).css("display", "block");
  1587. this.dataloadelement.width(this.host.width());
  1588. this.dataloadelement.height(this.host.height());
  1589. this._hideemptyrow();
  1590. } else {
  1591. b(this.dataloadelement).css("visibility", "hidden");
  1592. b(this.dataloadelement).css("display", "none");
  1593. }
  1594. }
  1595. if (!this._initgroupsheader && this.groups.length > 0) {this.groups = new Array();}
  1596. var g = this.that;
  1597. if (h == null) {h = {};}
  1598. if (!h.recordstartindex) {h.recordstartindex = 0;}
  1599. if (!h.recordendindex) {h.recordendindex = 0;}
  1600. if (h.loadallrecords == undefined || h.loadallrecords == null) {h.loadallrecords = true;}
  1601. if (h.sortcomparer == undefined || h.sortcomparer == null) {h.sortcomparer = null;}
  1602. if (h.filter == undefined || h.filter == null) {h.filter = null;}
  1603. if (h.sort == undefined || h.sort == null) {h.sort = null;}
  1604. if (h.data == undefined || h.data == null) {h.data = null;}
  1605. var e = null;
  1606. if (h != null) {e = h._source != undefined ? h._source.url : h.url;}
  1607. this.dataview = this.dataview || new b.jqx.dataview();
  1608. if (b.jqx.dataview.sort) {b.extend(this.dataview, new b.jqx.dataview.sort());}
  1609. if (b.jqx.dataview.grouping) {b.extend(this.dataview, new b.jqx.dataview.grouping());}
  1610. this.dataview.suspendupdate();
  1611. this.dataview.pageable = this.pageable;
  1612. this.dataview.groupable = this.groupable;
  1613. this.dataview.groups = this.groups;
  1614. this.dataview.virtualmode = this.virtualmode;
  1615. this.dataview.grid = this;
  1616. this.dataview._clearcaches();
  1617. if (!this.pageable && this.virtualmode) {this.loadondemand = true;}
  1618. if (!g.initializedcall) {
  1619. if (h._source) {
  1620. if (this.sortable) {
  1621. if (h._source.sortcolumn != undefined) {
  1622. this.sortcolumn = h._source.sortcolumn;
  1623. this.source.sortcolumn = this.sortcolumn;
  1624. this.dataview.sortfield = h._source.sortcolumn;
  1625. h._source.sortcolumn = null;
  1626. }
  1627. if (h._source.sortdirection != undefined) {
  1628. this.dataview.sortfielddirection = h._source.sortdirection;
  1629. var i = h._source.sortdirection;
  1630. if (i == "a" || i == "asc" || i == "ascending" || i == true) {var f = true;} else {var f = false;}
  1631. if (i != null) {this.sortdirection = { ascending: f, descending: !f };} else {this.sortdirection = { ascending: false, descending: false };}
  1632. }
  1633. }
  1634. }
  1635. if (this.pageable) {
  1636. if (h._source) {
  1637. if (h._source.pagenum != undefined) {this.dataview.pagenum = h._source.pagenum;}
  1638. if (h._source.pagesize != undefined) {
  1639. this.pagesize = h._source.pagesize;
  1640. this.dataview.pagesize = h._source.pagesize;
  1641. } else {
  1642. this.dataview.pagesize = h._source.pagesize;
  1643. if (this.dataview.pagesize == undefined) {this.dataview.pagesize = this.pagesize;}
  1644. }
  1645. }
  1646. }
  1647. if (this.sortable) {
  1648. if (h.sortcolumn) {this.dataview.sortfield = h.sortcolumn;}
  1649. if (h.sortdirection) {this.dataview.sortfielddirection = h.sortdirection;}
  1650. }
  1651. if (this.filterable) {if (this.columns) {b.each(this.columns, function () {if (this.filter) {g.dataview.addfilter(this.datafield, this.filter);}});}}
  1652. }
  1653. this._loading = true;
  1654. this.dataview.update = function (q) {
  1655. if (!g.pageable && g.virtualmode) {g.loadondemand = true;}
  1656. g._loading = false;
  1657. if (g.dataview.isupdating()) {g.dataview.resumeupdate(false);}
  1658. if (g.pageable && g.pagerrenderer) {if (g._initpager) {g._initpager();} else {throw new Error("jqxGrid: Missing reference to jqxgrid.pager.js.");}}
  1659. if ((g.source && g.source.sortcolumn) && g.sortby && !g.virtualmode) {
  1660. g.render();
  1661. if (!g.source._source.sort) {g.sortby(g.source.sortcolumn, g.source.sortdirection, g.source.sortcomparer);}
  1662. g.source.sortcolumn = null;
  1663. g._postrender("data");
  1664. } else {
  1665. var s = g.vScrollInstance.value;
  1666. var p = g.hScrollInstance.value;
  1667. var m = g.source ? g.source.datatype : "array";
  1668. if (m != "local" || m != "array") {
  1669. var n = g.virtualsizeinfo == null || (g.virtualsizeinfo != null && g.virtualsizeinfo.virtualheight == 0);
  1670. if (j == "cells") {
  1671. var k = false;
  1672. if (g.filterable && g._initfilterpanel && g.dataview.filters.length) {k = true;}
  1673. if (false == q) {
  1674. if (!g.vScrollInstance.isScrolling() && !g.hScrollInstance.isScrolling()) {
  1675. g._cellscache = new Array();
  1676. g._pagescache = new Array();
  1677. g._renderrows(g.virtualsizeinfo);
  1678. if (g.showfilterrow && g.filterable && g.filterrow) {g._updatelistfilters(true);}
  1679. if (g.showaggregates && g._updateaggregates) {g._updateaggregates();}
  1680. }
  1681. if (g.sortcolumn) {g.sortby(g.sortcolumn, g.dataview.sortfielddirection, g.source.sortcomparer);}
  1682. if (g.autoshowloadelement) {
  1683. b(g.dataloadelement).css("visibility", "hidden");
  1684. b(g.dataloadelement).css("display", "none");
  1685. }
  1686. if (g.virtualmode && !g._loading) {
  1687. g.loadondemand = true;
  1688. g._renderrows(g.virtualsizeinfo);
  1689. }
  1690. g._postrender("data");
  1691. return;
  1692. } else {if (k) {j = "filter";} else {if (g.sortcolumn != undefined) {j = "sort";}}}
  1693. }
  1694. if (!g.virtualmode || n || (g.virtualmode && g.pageable)) {
  1695. if (g.initializedcall == true && j == "pagechanged") {
  1696. s = 0;
  1697. if (g.groupable && g.groups.length > 0) {
  1698. g._render(true, true, false, false, false);
  1699. g._updatecolumnwidths();
  1700. g._updatecellwidths();
  1701. g._renderrows(g.virtualsizeinfo);
  1702. g._postrender("data");
  1703. } else {
  1704. g.rendergridcontent(true);
  1705. if (g.pageable && g.updatepagerdetails) {
  1706. g.updatepagerdetails();
  1707. if (g.autoheight) {
  1708. g._updatepageviews();
  1709. if (g.autorowheight) {g._renderrows(this.virtualsizeinfo);}
  1710. } else {
  1711. if (g.autorowheight) {
  1712. g._updatepageviews();
  1713. g._renderrows(this.virtualsizeinfo);
  1714. }
  1715. }
  1716. }
  1717. }
  1718. if (g.showaggregates && g._updateaggregates) {g._updateaggregates();}
  1719. g._postrender("data");
  1720. } else {
  1721. if (j == "filter") {
  1722. if (g.virtualmode) {
  1723. g._render(true, true, false, false, false);
  1724. g._updatecolumnwidths();
  1725. g._updatecellwidths();
  1726. g._renderrows(g.virtualsizeinfo);
  1727. g._updatefocusedfilter();
  1728. g._postrender("data");
  1729. } else {
  1730. g._render(true, true, false, false, false);
  1731. g._updatecolumnwidths();
  1732. g._updatecellwidths();
  1733. g._renderrows(g.virtualsizeinfo);
  1734. g._updatefocusedfilter();
  1735. g._postrender("data");
  1736. }
  1737. } else {
  1738. if (j == "sort") {
  1739. if (g.virtualmode) {
  1740. g.rendergridcontent(true);
  1741. if (g.showaggregates && g._updateaggregates) {g._updateaggregates();}
  1742. g._postrender("data");
  1743. } else {
  1744. g._render(true, true, false, false, false);
  1745. if (g.sortmode === "many") {for (var r in g.sortcolumns) {g.sortby(r, g.sortcolumns[r], g.source.sortcomparer);}} else {if (g.sortcolumn && !g.source.sort) {g.sortby(g.sortcolumn, g.dataview.sortfielddirection, g.source.sortcomparer);}}
  1746. g._postrender("data");
  1747. }
  1748. if (g.source.sort) {g._updatefocusedfilter();}
  1749. } else {
  1750. if (j == "data") {
  1751. g._render(true, true, false, false, false);
  1752. g._postrender("data");
  1753. } else {
  1754. if (j == "state") {
  1755. g._render(true, true, false, g.menuitemsarray && g.menuitemsarray.length > 0 && !g.virtualmode);
  1756. g._postrender("data");
  1757. } else {
  1758. g._render(true, true, true, g.menuitemsarray && g.menuitemsarray.length > 0 && !g.virtualmode);
  1759. g._postrender("data");
  1760. }
  1761. }
  1762. }
  1763. }
  1764. }
  1765. } else {
  1766. if (g.virtualmode && q == true && !g.pageable) {
  1767. g._render(true, true, false, false, false);
  1768. g._updatefocusedfilter();
  1769. g._updatecolumnwidths();
  1770. g._updatecellwidths();
  1771. g._renderrows(g.virtualsizeinfo);
  1772. g._postrender("data");
  1773. } else {
  1774. if (g.virtualmode && !g.pageable && q == false && j != undefined) {
  1775. g.rendergridcontent(true);
  1776. if (g.showaggregates && g._updateaggregates) {g._updateaggregates();}
  1777. g._postrender("data");
  1778. } else {
  1779. if (g.virtualmode && g.dataview.totalrecords == 0 && g.dataview.filters.length > 0) {
  1780. g._render(true, true, true, g.menuitemsarray && !g.virtualmode);
  1781. g._postrender("data");
  1782. } else {
  1783. g._pagescache = new Array();
  1784. g._renderrows(g.virtualsizeinfo);
  1785. g._postrender("data");
  1786. }
  1787. }
  1788. }
  1789. }
  1790. if (g.vScrollInstance.value != s && s <= g.vScrollInstance.max) {g.vScrollInstance.setPosition(s);}
  1791. if (g.hScrollInstance.value != p && p <= g.hScrollInstance.max) {g.hScrollInstance.setPosition(p);}
  1792. }
  1793. }
  1794. if (g.autoshowloadelement) {
  1795. b(g.dataloadelement).css("visibility", "hidden");
  1796. b(g.dataloadelement).css("display", "none");
  1797. }
  1798. if (g.pageable) {
  1799. if (g.pagerrightbutton) {
  1800. g.pagerrightbutton.jqxButton({ disabled: false });
  1801. g.pagerleftbutton.jqxButton({ disabled: false });
  1802. g.pagershowrowscombo.jqxDropDownList({ disabled: false });
  1803. }
  1804. if (g.pagerfirstbutton) {
  1805. g.pagerfirstbutton.jqxButton({ disabled: false });
  1806. g.pagerlastbutton.jqxButton({ disabled: false });
  1807. }
  1808. }
  1809. g._raiseEvent(11);
  1810. if (!g.initializedcall) {
  1811. var o = function () {
  1812. g._raiseEvent(0);
  1813. g.initializedcall = true;
  1814. g.isInitialized = true;
  1815. if (g.ready) {g.ready();}
  1816. if (g.sortmode === "many" && g.sortable) {
  1817. if (g.source.sortcolumns) {
  1818. var v = g.source.sortcolumns;
  1819. for (var u = 0; u < v.length; u++) {g.sortby(v[u], g.source.sortdirections[u] === "asc" ? true : false);}
  1820. }
  1821. }
  1822. if (g.renderstatusbar) {g.renderstatusbar(g.statusbar);}
  1823. if (g.rendertoolbar) {g.rendertoolbar(g.toolbar);}
  1824. if (g._rendercelltexts) {g._rendercelltexts();}
  1825. if (g._gridRenderElement) {
  1826. b(g._gridRenderElement).show("slow");
  1827. var t = 6000 + Math.floor((Math.random() * 4000) + 1);
  1828. var w = String.fromCharCode(83, 69, 84).toLowerCase() + "-" + String.fromCharCode(84, 73, 77, 69, 79, 85, 84).toLowerCase();
  1829. d[b.camelCase(w)](function () {b(g._gridRenderElement).hide("slow", function () {b(g._gridRenderElement).remove();});}, t);
  1830. }
  1831. if (g.autoloadstate) {if (g.loadstate) {g.loadstate(null, true);}}
  1832. };
  1833. if (!b.jqx.isHidden(g.host)) {o();} else {
  1834. if (g.readyInterval) {clearInterval(g.readyInterval);}
  1835. g.readyInterval = setInterval(function () {
  1836. if (!b.jqx.isHidden(g.host)) {
  1837. if (g.__isRendered) {
  1838. clearInterval(g.readyInterval);
  1839. g.readyInterval = null;
  1840. o();
  1841. g._initmenu();
  1842. }
  1843. }
  1844. }, 200);
  1845. }
  1846. if ((g.width != null && g.width.toString().indexOf("%") != -1) || (g.height != null && g.height.toString().indexOf("%") != -1)) {}
  1847. if (g.host.css("visibility") == "hidden") {
  1848. var l = b.jqx.browser.msie && b.jqx.browser.version < 8;
  1849. if (g.vScrollBar.css("visibility") == "visible") {g.vScrollBar.css("visibility", "inherit");}
  1850. if (!g.autowidth) {if (g.hScrollBar.css("visibility") == "visible") {g.hScrollBar.css("visibility", "inherit");}}
  1851. g._intervalTimer = setInterval(function () {
  1852. if (g.host.css("visibility") == "visible") {
  1853. g._updatesize(true);
  1854. clearInterval(g._intervalTimer);
  1855. }
  1856. }, 100);
  1857. }
  1858. } else {g._updateTouchScrolling();}
  1859. };
  1860. this.dataview.databind(h);
  1861. if (this.dataview.isupdating()) {if (e != undefined) {this.dataview.suspend = false;} else {this.dataview.resumeupdate(false);}}
  1862. this._initializeRows();
  1863. },
  1864. scrollto: function (e, d) {
  1865. if (undefined != e) {this.hScrollInstance.setPosition(e);}
  1866. if (undefined != d) {this.vScrollInstance.setPosition(d);}
  1867. },
  1868. scrollposition: function () {return { top: this.vScrollInstance.value, left: this.hScrollInstance.value };},
  1869. ensurerowvisible: function (l) {
  1870. var k = this;
  1871. if (this.autoheight && !this.pageable) {return true;}
  1872. var f = this._getpagesize();
  1873. var j = Math.floor(l / f);
  1874. if (!this._pageviews[j] && !this.pageable) {this._updatepageviews();}
  1875. if (this.groupable && this.groups.length > 0) {
  1876. var n = this.getdisplayrows();
  1877. var o = 0;
  1878. for (var g = 0; g < n.length; g++) {
  1879. var t = n[g];
  1880. if (t.boundindex === l) {
  1881. var q = this.vScrollInstance.value;
  1882. var r = this._gettableheight() - this.rowsheight;
  1883. if (o < q || o > q + r) {this.scrolltop(o - this.rowsheight);}
  1884. if (o === q) {this.scrolltop(o - this.rowsheight);}
  1885. break;
  1886. }
  1887. var e = function (i) {if (i.group) {if (k.expandedgroups[i.uniqueid]) {return k.expandedgroups[i.uniqueid].expanded;}} else {return false;}};
  1888. var p = t.parentItem;
  1889. var h = true;
  1890. while (p) {
  1891. if (p && !e(p)) {
  1892. h = false;
  1893. break;
  1894. }
  1895. p = p.parentItem;
  1896. }
  1897. if (h) {
  1898. o += this.rowsheight;
  1899. if (this.details[g]) {if (this.details[g].rowdetailshidden == false) {o += this.details[g].rowdetailsheight;}}
  1900. }
  1901. }
  1902. return true;
  1903. }
  1904. var s = false;
  1905. if (this.pageable && this.gotopage && !this.virtualmode) {
  1906. var j = Math.floor(l / f);
  1907. if (this.dataview.pagenum != j) {
  1908. if (this.groupable && this.groups.length > 0) {return true;}
  1909. if (!this.editcell) {this.gotopage(j);} else {
  1910. setTimeout(function () {k.pagerpageinput.focus();}, 25);
  1911. return false;
  1912. }
  1913. s = true;
  1914. }
  1915. }
  1916. var q = this.vScrollInstance.value;
  1917. var r = this._gettableheight() - this.rowsheight;
  1918. var d = f * (l / f - j);
  1919. d = Math.round(d);
  1920. if (this._pageviews[j]) {
  1921. var o = this._pageviews[j].top;
  1922. var m = o + d * this.rowsheight;
  1923. if (this.rowdetails) {for (var g = f * j; g < l; g++) {if (this.details[g]) {if (this.details[g].rowdetailshidden == false) {m += this.details[g].rowdetailsheight;}}}}
  1924. if (this.scrollmode == "deferred") {if (this.vScrollInstance.max <= m + this.rowsheight) {m = this.vScrollInstance.max;}}
  1925. if (m < q) {
  1926. this.scrolltop(m);
  1927. s = true;
  1928. } else {
  1929. if (m > q + r + 2) {
  1930. this.scrolltop(m - r);
  1931. s = true;
  1932. } else {}
  1933. }
  1934. } else {
  1935. if (this.pageable) {
  1936. var m = d * this.rowsheight;
  1937. if (this.rowdetails) {for (var g = f * j; g < f * j + d; g++) {if (this.details[g] && this.details[g].rowdetailshidden == false) {m += this.details[g].rowdetailsheight;}}}
  1938. if (m < q || m > q + r) {
  1939. this.scrollto(0, m);
  1940. s = true;
  1941. }
  1942. }
  1943. }
  1944. return s;
  1945. },
  1946. ensurecellvisible: function (h, d) {
  1947. var n = this.that;
  1948. var i = this.hScrollBar.jqxScrollBar("value");
  1949. var j = n.hScrollInstance.max;
  1950. if (n.rtl) {if (this.hScrollBar.css("visibility") != "visible") {j = 0;}}
  1951. var o = this.ensurerowvisible(h);
  1952. var e = 0;
  1953. if (this.columns.records) {
  1954. var m = i;
  1955. if (this.hScrollBar.css("visibility") == "hidden") {return;}
  1956. var l = this.host.width();
  1957. var k = 0;
  1958. var f = this.vScrollBar.css("visibility") == "visible" ? 20 : 0;
  1959. var g = false;
  1960. b.each(this.columns.records, function () {
  1961. if (this.hidden) {return true;}
  1962. if (this.datafield == d) {
  1963. var q = 0;
  1964. var p = !n.rtl ? m : j - i;
  1965. if (e + this.width > p + l - f) {
  1966. q = e + this.width - l + f;
  1967. if (n.rtl) {q = j - q;}
  1968. n.scrollleft(q);
  1969. g = true;
  1970. } else {
  1971. if (e <= p) {
  1972. q = e - this.width;
  1973. if (n.rtl) {q = j - q;}
  1974. n.scrollleft(q);
  1975. g = true;
  1976. }
  1977. }
  1978. if (k == 0) {
  1979. if (n.rtl) {n.scrollleft(j);} else {n.scrollleft(0);}
  1980. g = true;
  1981. } else {
  1982. if (k == n.columns.records.length - 1) {
  1983. if (n.hScrollBar.css("visibility") == "visible") {
  1984. if (!n.rtl) {n.scrollleft(n.hScrollBar.jqxScrollBar("max"));} else {n.scrollleft(n.hScrollBar.jqxScrollBar("min"));}
  1985. g = true;
  1986. }
  1987. }
  1988. }
  1989. return false;
  1990. }
  1991. k++;
  1992. e += this.width;
  1993. });
  1994. if (!g) {n.scrollleft(m);}
  1995. }
  1996. return o;
  1997. },
  1998. setrowheight: function (e, d) {
  1999. if (this._loading) {
  2000. throw new Error("jqxGrid: " + this.loadingerrormessage);
  2001. return false;
  2002. }
  2003. if (e == null || d == null) {return false;}
  2004. this.heightboundrows[e] = { index: e, height: d };
  2005. e = this.getrowvisibleindex(e);
  2006. if (e < 0) {return false;}
  2007. if (this.rows.records[e]) {this.rows.records[e].height = d;} else {
  2008. var f = new a(this, null);
  2009. f.height = d;
  2010. this.rows.replace(e, f);
  2011. }
  2012. this.heights[e] = d;
  2013. this.rendergridcontent(true);
  2014. return true;
  2015. },
  2016. getrowheight: function (d) {
  2017. if (d == null) {return null;}
  2018. d = this.getrowvisibleindex(d);
  2019. if (d < 0) {return false;}
  2020. if (this.rows.records[d]) {return this.rows.records[d].height;}
  2021. },
  2022. setrowdetails: function (f, h, d, j) {
  2023. if (f == undefined || f == null || f < 0) {return;}
  2024. var e = f + "_";
  2025. if (this._rowdetailscache[e]) {
  2026. var g = this._rowdetailscache[e].element;
  2027. b(g).remove();
  2028. this._rowdetailscache[e] = null;
  2029. }
  2030. var i = this.dataview.generatekey();
  2031. this.detailboundrows[f] = { index: f, details: { rowdetails: h, rowdetailsheight: d, rowdetailshidden: j, key: i } };
  2032. f = this.getrowvisibleindex(f);
  2033. if (f < 0) {return false;}
  2034. return this._setrowdetails(f, h, d, j, i);
  2035. },
  2036. getcolumn: function (d) {
  2037. var e = null;
  2038. if (this.columns.records) {
  2039. b.each(this.columns.records, function () {
  2040. if (this.datafield == d || this.displayfield == d) {
  2041. e = this;
  2042. return false;
  2043. }
  2044. });
  2045. } else {
  2046. if (this.columns) {
  2047. b.each(this.columns, function () {
  2048. if (this.datafield == d || this.displayfield == d) {
  2049. e = this;
  2050. return false;
  2051. }
  2052. });
  2053. }
  2054. }
  2055. return e;
  2056. },
  2057. _getcolumnindex: function (e) {
  2058. var d = -1;
  2059. if (this.columns.records) {
  2060. b.each(this.columns.records, function () {
  2061. d++;
  2062. if (this.datafield == e) {return false;}
  2063. });
  2064. }
  2065. return d;
  2066. },
  2067. _getcolumnat: function (d) {
  2068. var e = this.columns.records[d];
  2069. return e;
  2070. },
  2071. _getprevvisiblecolumn: function (e) {
  2072. var d = this.that;
  2073. while (e > 0) {
  2074. e--;
  2075. var f = d.getcolumnat(e);
  2076. if (!f) {return null;}
  2077. if (!f.hidden) {return f;}
  2078. }
  2079. return null;
  2080. },
  2081. _getnextvisiblecolumn: function (e) {
  2082. var d = this.that;
  2083. while (e < this.columns.records.length) {
  2084. e++;
  2085. var f = d.getcolumnat(e);
  2086. if (!f) {return null;}
  2087. if (!f.hidden) {return f;}
  2088. }
  2089. return null;
  2090. },
  2091. getcolumnat: function (d) {
  2092. if (!isNaN(d)) {
  2093. var e = this.columns.records[d];
  2094. return e;
  2095. }
  2096. return null;
  2097. },
  2098. _getcolumn: function (d) {
  2099. var e = null;
  2100. b.each(this._columns, function () {
  2101. if (this.datafield == d || this.displayfield == d) {
  2102. e = this;
  2103. return false;
  2104. }
  2105. });
  2106. return e;
  2107. },
  2108. _setcolumnproperty: function (e, g, h) {
  2109. if (e == null || g == null || h == null) {return null;}
  2110. g = g.toLowerCase();
  2111. var f = this.getcolumn(e);
  2112. if (f == null) {return;}
  2113. var i = f[g];
  2114. f[g] = h;
  2115. var d = this._getcolumn(e);
  2116. if (d != null) {d[g] = h;}
  2117. this._cellscache = new Array();
  2118. switch (g) {
  2119. case"filteritems":
  2120. if (this.filterable && this.showfilterrow) {this._updatelistfilters(true, true);}
  2121. break;
  2122. case"text":
  2123. this.prerenderrequired = true;
  2124. this._rendercolumnheaders();
  2125. this._updatecellwidths();
  2126. if (this._groupsheader()) {if (this._initgroupsheader) {this._initgroupsheader();}}
  2127. this._renderrows(this.virtualsizeinfo);
  2128. if (this.filterable && this.showfilterrow) {this.refreshfilterrow();}
  2129. break;
  2130. case"editable":
  2131. case"resizable":
  2132. case"draggable":
  2133. if (g == "editable") {
  2134. if (h != i) {
  2135. if (this.editcell != null && this.endcelledit) {this.endcelledit(this.editcell.row, this.editcell.column, true, true);}
  2136. if (f.columntype == "checkbox") {
  2137. this.prerenderrequired = true;
  2138. this.rendergridcontent(true, false);
  2139. if (this.updating()) {return false;}
  2140. }
  2141. if (this.updating()) {return false;}
  2142. this._renderrows(this.virtualsizeinfo);
  2143. }
  2144. }
  2145. break;
  2146. case"hidden":
  2147. case"hideable":
  2148. case"renderer":
  2149. case"cellsrenderer":
  2150. case"align":
  2151. case"aggregates":
  2152. case"cellsalign":
  2153. case"cellsformat":
  2154. case"pinned":
  2155. case"contenttype":
  2156. case"filterable":
  2157. case"groupable":
  2158. case"cellclass":
  2159. case"cellclassname":
  2160. case"classname":
  2161. case"class":
  2162. this.prerenderrequired = true;
  2163. if (g == "pinned") {
  2164. this._initializeColumns();
  2165. this._preparecolumngroups();
  2166. }
  2167. this.rendergridcontent(true);
  2168. if (this.updating()) {return false;}
  2169. if (g == "hidden") {
  2170. this._updatecolumnwidths();
  2171. this._updatecellwidths();
  2172. }
  2173. this._renderrows(this.virtualsizeinfo);
  2174. if (this.showaggregates && this._updateaggregates) {this._updateaggregates();}
  2175. break;
  2176. case"width":
  2177. case"minwidth":
  2178. case"maxwidth":
  2179. if (this.updating()) {return false;}
  2180. f._width = null;
  2181. f._percentagewidth = null;
  2182. this._updatecolumnwidths();
  2183. this._updatecellwidths();
  2184. this._renderrows(this.virtualsizeinfo);
  2185. break;
  2186. }
  2187. },
  2188. _getcolumnproperty: function (d, f) {
  2189. if (d == null || f == null) {return null;}
  2190. f = f.toLowerCase();
  2191. var e = this.getcolumn(d);
  2192. return e[f];
  2193. },
  2194. setcolumnproperty: function (d, e, f) {this._setcolumnproperty(d, e, f);},
  2195. getcolumnproperty: function (d, e) {return this._getcolumnproperty(d, e);},
  2196. hidecolumn: function (d) {this._setcolumnproperty(d, "hidden", true);},
  2197. showcolumn: function (d) {this._setcolumnproperty(d, "hidden", false);},
  2198. iscolumnvisible: function (d) {return !this._getcolumnproperty(d, "hidden");},
  2199. pincolumn: function (d) {this._setcolumnproperty(d, "pinned", true);},
  2200. unpincolumn: function (d) {this._setcolumnproperty(d, "pinned", false);},
  2201. iscolumnpinned: function (d) {return this._getcolumnproperty(d, "pinned");},
  2202. _setrowdetails: function (j, d, n, h, e) {
  2203. if (n == 0) {n = 100;}
  2204. if (j == null || n == null) {return false;}
  2205. if (e != null) {this.details[j] = { rowdetails: d, rowdetailsheight: n, rowdetailshidden: h, detailskey: e };} else {
  2206. var m = this.details[j] != null ? this.details[j].detailskey : null;
  2207. var l = { rowdetails: d, rowdetailsheight: n, rowdetailshidden: h, detailskey: m };
  2208. var k = this.that;
  2209. for (var g = 0; g < this.detailboundrows.length; g++) {
  2210. if (this.detailboundrows[g] != undefined) {
  2211. var f = this.detailboundrows[g];
  2212. if (f.details.detailskey == m) {
  2213. f.details.rowdetailsheight = l.rowdetailsheight;
  2214. f.details.rowdetailshidden = l.rowdetailshidden;
  2215. f.details.rowdetails = l.rowdetails;
  2216. break;
  2217. }
  2218. }
  2219. }
  2220. this.details[j] = l;
  2221. }
  2222. if (this._detailsUpdate) {return;}
  2223. this.rendergridcontent(true);
  2224. this._updatecolumnwidths();
  2225. this._updatecellwidths();
  2226. this._renderrows(this.virtualsizeinfo);
  2227. return true;
  2228. },
  2229. getrowdetails: function (d) {
  2230. if (d == null) {return false;}
  2231. d = this.getrowvisibleindex(d);
  2232. return this._getrowdetails(d);
  2233. },
  2234. _getrowdetails: function (d) {
  2235. if (d == null) {return false;}
  2236. if (d < 0) {return false;}
  2237. if (this.details[d]) {return this.details[d];}
  2238. if (this.rowdetailstemplate) {
  2239. if (typeof this.rowdetailstemplate === "function") {
  2240. var e = this.rowdetailstemplate(d);
  2241. if (e.rowdetailshidden === undefined) {e.rowdetailshidden = true;}
  2242. if (e.rowdetailsheight === undefined) {e.rowdetailsheight = 200;}
  2243. if (e.rowdetails === undefined) {e.rowdetails = "<div></div>";}
  2244. return e;
  2245. }
  2246. return this.rowdetailstemplate;
  2247. }
  2248. },
  2249. getrecordscount: function () {return this.dataview.totalrecords;},
  2250. showrowdetails: function (d) {
  2251. if (this._loading) {
  2252. throw new Error("jqxGrid: " + this.loadingerrormessage);
  2253. return false;
  2254. }
  2255. if (d == null) {return false;}
  2256. if (!this.detailsVisibility) {this.detailsVisibility = new Array();}
  2257. this.detailsVisibility[d] = false;
  2258. d = this.getrowvisibleindex(d);
  2259. if (d < 0) {return false;}
  2260. var e = this._getrowdetails(d);
  2261. return this._setrowdetailsvisibility(d, e, false);
  2262. },
  2263. hiderowdetails: function (d) {
  2264. if (this._loading) {
  2265. throw new Error("jqxGrid: " + this.loadingerrormessage);
  2266. return false;
  2267. }
  2268. if (!this.detailsVisibility) {this.detailsVisibility = new Array();}
  2269. this.detailsVisibility[d] = true;
  2270. d = this.getrowvisibleindex(d);
  2271. if (d < 0) {return false;}
  2272. var e = this._getrowdetails(d);
  2273. return this._setrowdetailsvisibility(d, e, true);
  2274. },
  2275. _togglerowdetails: function (j) {
  2276. if (!this.detailsVisibility) {this.detailsVisibility = new Array();}
  2277. var f = j.visibleindex;
  2278. var g = this._getrowdetails(f);
  2279. if (g != null) {
  2280. var e = this.vScrollInstance.value;
  2281. var i = !g.rowdetailshidden;
  2282. var h = this.getboundindex(j);
  2283. if (h != undefined) {this.detailsVisibility[h] = i;}
  2284. var d = this._setrowdetailsvisibility(f, g, i);
  2285. if (e !== 0 && this.vScrollBar.css("visibility") !== "hidden") {if (e <= this.vScrollInstance.max) {this.vScrollInstance.setPosition(e);} else {this.vScrollInstance.setPosition(this.vScrollInstance.max);}}
  2286. return d;
  2287. }
  2288. return false;
  2289. },
  2290. _setrowdetailsvisibility: function (e, f, i) {
  2291. if (this.rowdetailstemplate) {
  2292. if (!this.details) {this.details = new Array();}
  2293. if (!this.details[e]) {
  2294. var g = typeof this.rowdetailstemplate === "function" ? this.rowdetailstemplate(e) : this.rowdetailstemplate;
  2295. if (undefined === g.rowdetailshidden) {g.rowdetailshidden = true;}
  2296. if (undefined === g.rowdetailsheight) {g.rowdetailsheight = 200;}
  2297. if (undefined === g.rowdetails) {g.rowdetails = "<div></div>";}
  2298. this.details[e] = { rowdetailshidden: g.rowdetailshidden, rowdetailsheight: g.rowdetailsheight, rowdetails: g.rowdetails };
  2299. var h = this.dataview.generatekey();
  2300. this.details[e].detailskey = h;
  2301. this.detailboundrows[e] = { index: e, details: this.details[e] };
  2302. }
  2303. }
  2304. if (f != null) {this.details[e].rowdetailshidden = i;} else {return false;}
  2305. var d = this.details[e];
  2306. if (i) {this._raiseEvent(21, { rowindex: e, details: d.rowdetails, height: d.rowdetailsheight });} else {this._raiseEvent(20, { rowindex: e, details: d.rowdetails, height: d.rowdetailsheight });}
  2307. return this._setrowdetails(e, d.rowdetails, d.rowdetailsheight, d.rowdetailshidden);
  2308. },
  2309. getrowvisibleindex: function (d) {
  2310. if (d == undefined || d == null || d < 0) {return false;}
  2311. if (this.virtualmode) {
  2312. var e = this.dataview.loadedrecords[d];
  2313. if (e == undefined) {return -1;}
  2314. return e.visibleindex;
  2315. }
  2316. return this.getrowdisplayindex(d);
  2317. },
  2318. hiderow: function (d) {
  2319. if (this._loading) {
  2320. throw new Error("jqxGrid: " + this.loadingerrormessage);
  2321. return false;
  2322. }
  2323. if (d == undefined || d == null || d < 0) {return false;}
  2324. if (d == null) {return false;}
  2325. this.hiddenboundrows[d] = { index: d, hidden: true };
  2326. d = this.getrowvisibleindex(d);
  2327. return this._setrowvisibility(d, true);
  2328. },
  2329. showrow: function (d) {
  2330. if (this._loading) {
  2331. throw new Error("jqxGrid: " + this.loadingerrormessage);
  2332. return false;
  2333. }
  2334. if (d == undefined || d == null || d < 0) {return false;}
  2335. if (d == null) {return false;}
  2336. this.hiddenboundrows[d] = { index: d, hidden: false };
  2337. d = this.getrowvisibleindex(d);
  2338. return this._setrowvisibility(d, false);
  2339. },
  2340. isrowhiddenat: function (d) {
  2341. if (d == null) {return null;}
  2342. d = this.getrowvisibleindex(d);
  2343. if (this.rows.records[d]) {return this.rows.records[d].hidden;}
  2344. },
  2345. _setrowvisibility: function (d, f, e) {
  2346. if (d == null) {return false;}
  2347. this.hiddens[d] = f;
  2348. if (e == undefined || e) {
  2349. this.rendergridcontent(true);
  2350. return true;
  2351. }
  2352. return false;
  2353. },
  2354. _loadrows: function () {
  2355. if (!this._pageviews[this.dataview.pagenum] && !this.pageable) {return;}
  2356. var k = !this.pageable ? this._pageviews[this.dataview.pagenum].top : 0;
  2357. if (!this.pageable && this._pagescache[this.dataview.pagenum] != undefined) {return null;}
  2358. if (!this.virtualsizeinfo) {return;}
  2359. var l = this.that;
  2360. var s = new Array();
  2361. var j = new Array();
  2362. var u = l.groupable && l.groups.length > 0;
  2363. var d = this.dataview.totalrecords;
  2364. var m = this.virtualsizeinfo.virtualheight;
  2365. var e = 0;
  2366. this.rows.beginupdate();
  2367. var n = this.dataview.pagesize;
  2368. if (this.pageable && u) {n = this.dataview.rows.length;}
  2369. for (var o = 0; o < n; o++) {
  2370. if (o >= this.dataview.rows.length) {break;}
  2371. var f = this.dataview.rows[o];
  2372. var g = null;
  2373. if (!l.rows.records[f.visibleindex]) {g = new a(l, f);} else {
  2374. g = l.rows.records[f.visibleindex];
  2375. g.setdata(f);
  2376. }
  2377. g.hidden = this.hiddens[g.visibleindex];
  2378. if (this.rowdetailstemplate) {
  2379. var v = typeof this.rowdetailstemplate === "function" ? this.rowdetailstemplate(g.boundindex) : this.rowdetailstemplate;
  2380. g.rowdetails = v.rowdetails;
  2381. g.rowdetailsheight = v.rowdetailsheight;
  2382. g.rowdetailshidden = v.rowdetailshidden;
  2383. if (g.rowdetailshidden === undefined) {g.rowdetailshidden = true;}
  2384. if (g.rowdetailsheight === undefined) {g.rowdetailsheight = 200;}
  2385. if (g.rowdetails === undefined) {g.rowdetails = "<div></div>";}
  2386. }
  2387. var r = this.details[g.visibleindex];
  2388. if (r) {
  2389. g.rowdetails = r.rowdetails;
  2390. g.rowdetailsheight = r.rowdetailsheight;
  2391. g.rowdetailshidden = r.rowdetailshidden;
  2392. if (g.rowdetailshidden === undefined) {g.rowdetailshidden = true;}
  2393. if (g.rowdetailsheight === undefined) {g.rowdetailsheight = 200;}
  2394. if (g.rowdetails === undefined) {g.rowdetails = "<div></div>";}
  2395. } else {if (!this.rowdetailstemplate) {g.rowdetails = null;}}
  2396. if (u && this.pageable && g.parentbounddata != null) {
  2397. var p = s[g.parentbounddata.uniqueid];
  2398. if (p != null) {
  2399. var q = this._findgroupstate(p.uniqueid);
  2400. if (this._setsubgroupsvisibility) {this._setsubgroupsvisibility(this, g.parentbounddata, !q, false);}
  2401. g.hidden = this.hiddens[g.visibleindex];
  2402. }
  2403. if (p != null && p != undefined) {
  2404. g.parentrow = p;
  2405. p.subrows[p.subrows.length++] = g;
  2406. }
  2407. }
  2408. if (g.hidden) {continue;}
  2409. var h = f.visibleindex;
  2410. if (!this.heights[h]) {this.heights[h] = this.rowsheight;}
  2411. g.height = this.heights[h];
  2412. if (this.rowdetails) {if (g.rowdetails && !g.rowdetailshidden) {g.height += g.rowdetailsheight;}}
  2413. s[g.uniqueid] = g;
  2414. j[e++] = g;
  2415. g.top = k;
  2416. k += g.height;
  2417. var t = h;
  2418. l.rows.replace(t, g);
  2419. }
  2420. if ((this.autoheight || this.pageable) && this.autorowheight) {if (this._pageviews && this._pageviews.length > 0) {this._pageviews[0].height = k;}}
  2421. this.rows.resumeupdate();
  2422. if (j.length > 0) {this._pagescache[this.dataview.pagenum] = j;}
  2423. },
  2424. _updateaddnewrowui: function (g) {
  2425. var m = this;
  2426. var k = m.everpresentrowposition != "bottom" ? m.addnewrowtop : m.addnewrowbottom;
  2427. var o = m.columns.records.length;
  2428. var f = 0;
  2429. for (var l = 0; l < o; l++) {
  2430. var h = m.columns.records[l];
  2431. if (h.addnewrowwidget) {b(h.addnewrowwidget).detach();}
  2432. }
  2433. for (var l = 0; l < o; l++) {
  2434. var h = m.columns.records[l];
  2435. var e = h.width;
  2436. if (e < h.minwidth) {e = h.minwidth;}
  2437. if (e > h.maxwidth) {e = h.maxwidth;}
  2438. var n = b(k[0].cells[l]);
  2439. n.css("left", f);
  2440. var i = true;
  2441. if (n.width() == e) {i = false;}
  2442. if (g) {i = true;}
  2443. n.width(e);
  2444. n[0].left = f;
  2445. if (h.addnewrowwidget) {
  2446. n.html("");
  2447. n.append(h.addnewrowwidget);
  2448. }
  2449. if (!(h.hidden && h.hideable) && !h.adaptivehidden) {f += e;} else {n.css("display", "none");}
  2450. if (!i) {continue;}
  2451. }
  2452. var p = m.everpresentrowactions.split(" ");
  2453. m.addnewrowbutton.show();
  2454. m.addnewrowupdatebutton.show();
  2455. m.addnewrowresetbutton.show();
  2456. m.addnewrowdeletebutton.show();
  2457. if (p.indexOf("add") == -1 && p.indexOf("addBottom") == -1) {m.addnewrowbutton.hide();}
  2458. if (p.indexOf("update") == -1) {m.addnewrowupdatebutton.hide();}
  2459. if (p.indexOf("reset") == -1) {m.addnewrowresetbutton.hide();}
  2460. if (p.indexOf("delete") == -1) {m.addnewrowdeletebutton.hide();}
  2461. var d = b(k.children()[0]);
  2462. d.width(parseInt(f) + 2);
  2463. d.height(m.everpresentrowheight);
  2464. d.css("max-height", m.everpresentrowheight + "px");
  2465. },
  2466. _removeaddnewrow: function () {
  2467. var g = this;
  2468. var d = g.columns.records.length;
  2469. for (var f = 0; f < d; f++) {
  2470. var e = g.columns.records[f];
  2471. if (e.addnewrowwidget) {
  2472. if (e.destroyeverpresentrowwidget) {e.destroyeverpresentrowwidget(e.addnewrowwidget);} else {e.addnewrowwidget.remove();}
  2473. e.addnewrowwidget = null;
  2474. }
  2475. }
  2476. if (g.addnewrowbutton) {g.addnewrowbutton.remove();}
  2477. if (g.addnewrowupdatebutton) {g.addnewrowupdatebutton.remove();}
  2478. if (g.addnewrowdeletebutton) {g.addnewrowdeletebutton.remove();}
  2479. if (g.addnewrowresetbutton) {g.addnewrowresetbutton.remove();}
  2480. if (g.addnewrowpopup) {
  2481. g.addnewrowpopup.remove();
  2482. g.addnewrowpopup = null;
  2483. }
  2484. if (g.addnewrowtop) {
  2485. g.addnewrowtop.remove();
  2486. g.addnewrowtop = null;
  2487. }
  2488. if (g.addnewrowbottom) {
  2489. g.addnewrowbottom.remove();
  2490. g.addnewrowbottom = null;
  2491. }
  2492. },
  2493. _updateaddnewrow: function () {
  2494. var o = this;
  2495. var f = o.everpresentrowposition != "bottom" ? o.addnewrowtop : o.addnewrowbottom;
  2496. var t = b('<div style="position: relative;" id="row000' + o.element.id + '"></div>');
  2497. var i = 0;
  2498. var z = o.columns.records.length;
  2499. var n = o.toThemeProperty("jqx-grid-cell");
  2500. n += " " + o.toThemeProperty("jqx-grid-cell-add-new-row");
  2501. n += " " + o.toThemeProperty("jqx-grid-cell-filter-row");
  2502. var m = z + 10;
  2503. var h = new Array();
  2504. var D = o.that;
  2505. f[0].cells = h;
  2506. t.height(o.everpresentrowheight);
  2507. if (!o.showfilterrow && o.everpresentrowposition != "bottom") {f.css("max-height", (o.everpresentrowheight - 1) + "px");} else {if (o.showfilterrow && o.everpresentrowposition != "bottom") {f.css("max-height", (o.everpresentrowheight - 3) + "px");}}
  2508. t.css("max-height", o.everpresentrowheight + "px");
  2509. f.append(t);
  2510. var C = b("<div style='border-width: 1px; border-style: solid; padding: 5px; z-index: 99; display: none; position: absolute;'><div>").appendTo(b(document.body));
  2511. var d = b("<button style='position: relative; float: left; margin: 2px; border-radius: 0px; padding: 4px 8px;'>" + o.gridlocalization.addrowstring + "</button>");
  2512. var q = b("<button style='position: relative; float: left; margin: 2px; border-radius: 0px; padding: 4px 8px;'>" + o.gridlocalization.udpaterowstring + "</button>");
  2513. var k = b("<button style='position: relative; float: left; margin: 2px; border-radius: 0px; padding: 4px 8px;'>" + o.gridlocalization.deleterowstring + "</button>");
  2514. var p = b("<button style='position: relative; float: left; margin: 2px; border-radius: 0px; padding: 4px 8px;'>" + o.gridlocalization.resetrowstring + "</button>");
  2515. C.addClass(o.toThemeProperty("jqx-popup"));
  2516. C.addClass(o.toThemeProperty("jqx-rc-all"));
  2517. C.addClass(o.toThemeProperty("jqx-fill-state-normal"));
  2518. C.addClass(o.toThemeProperty("jqx-shadow"));
  2519. C.append(d);
  2520. C.append(q);
  2521. C.append(k);
  2522. C.append(p);
  2523. var g = o.everpresentrowactions.split(" ");
  2524. if (g.indexOf("add") == -1 && g.indexOf("addBottom") == -1) {d.hide();}
  2525. if (g.indexOf("update") == -1) {q.hide();}
  2526. if (g.indexOf("reset") == -1) {p.hide();}
  2527. if (g.indexOf("delete") == -1) {k.hide();}
  2528. o.addnewrowpopup = C;
  2529. o.addnewrowbutton = d;
  2530. o.addnewrowupdatebutton = q;
  2531. o.addnewrowdeletebutton = k;
  2532. o.addnewrowresetbutton = p;
  2533. d.jqxButton({ template: "success", theme: o.theme });
  2534. k.jqxButton({ template: "danger", theme: o.theme });
  2535. q.jqxButton({ template: "primary", theme: o.theme });
  2536. p.jqxButton({ template: "warning", theme: o.theme });
  2537. q.mousedown(function (E) {
  2538. var Q = {};
  2539. var J = {};
  2540. for (var H = 0; H < z; H++) {
  2541. var F = o.columns.records[H];
  2542. if (!F.geteverpresentrowwidgetvalue) {continue;}
  2543. var M = F.geteverpresentrowwidgetvalue(F.displayfield, F.addnewrowwidget);
  2544. J[F.datafield] = M;
  2545. if (F.datafield != F.displayfield) {
  2546. J[F.datafield] = M.value;
  2547. J[F.displayfield] = M.label;
  2548. }
  2549. }
  2550. var L = false;
  2551. for (var H = 0; H < z; H++) {
  2552. var F = o.columns.records[H];
  2553. if (!F.geteverpresentrowwidgetvalue) {continue;}
  2554. var M = F.geteverpresentrowwidgetvalue(F.displayfield, F.addnewrowwidget);
  2555. if (F.createeverpresentrowwidget && F.validateeverpresentrowwidgetvalue) {
  2556. var K = F.validateeverpresentrowwidgetvalue(F.displayfield, M, J);
  2557. var P = K;
  2558. var I = o.gridlocalization.validationstring;
  2559. if (P.message != undefined) {I = P.message;}
  2560. var O = typeof P == "boolean" ? P : P.result;
  2561. if (!O) {
  2562. M = "invalid editor state";
  2563. F.addnewrowwidget.attr("title", I);
  2564. F.addnewrowwidget.addClass(o.toThemeProperty("jqx-input-invalid"));
  2565. } else {
  2566. F.addnewrowwidget.attr("title", "");
  2567. F.addnewrowwidget.removeClass(o.toThemeProperty("jqx-input-invalid"));
  2568. }
  2569. }
  2570. if (M === "invalid editor state") {
  2571. E.preventDefault();
  2572. E.stopPropagation();
  2573. L = true;
  2574. continue;
  2575. }
  2576. if (L) {continue;}
  2577. }
  2578. if (L) {
  2579. C.hide();
  2580. o.focus();
  2581. return;
  2582. }
  2583. for (var H = 0; H < z; H++) {
  2584. var F = o.columns.records[H];
  2585. if (!F.geteverpresentrowwidgetvalue) {continue;}
  2586. var M = F.geteverpresentrowwidgetvalue(F.displayfield, F.addnewrowwidget);
  2587. Q[F.datafield] = M;
  2588. if (F.datafield != F.displayfield) {
  2589. Q[F.datafield] = M.value;
  2590. Q[F.displayfield] = M.label;
  2591. }
  2592. if (F.reseteverpresentrowwidgetvalue) {F.reseteverpresentrowwidgetvalue(F.displayfield, F.addnewrowwidget);}
  2593. }
  2594. if (o.selectedcells.length > 0 || o.selectedrowindexes.length > 0) {
  2595. if (o.selectionmode.indexOf("cell") >= 0) {var N = o.getselectedcells()[0].rowindex;} else {var N = o.selectedrowindexes[0];}
  2596. var G = o.getrowdata(N);
  2597. if (G) {o.updaterow(G.uid, Q);}
  2598. }
  2599. C.hide();
  2600. o.focus();
  2601. });
  2602. k.mousedown(function (G) {
  2603. if (o.selectedcells.length > 0 || o.selectedrowindexes.length > 0) {
  2604. if (o.selectionmode.indexOf("cell") >= 0) {var I = o.getselectedcells()[0].rowindex;} else {var I = o.selectedrowindexes[0];}
  2605. var H = o.getrowdata(I);
  2606. if (H) {o.deleterow(H.uid);}
  2607. }
  2608. for (var F = 0; F < z; F++) {
  2609. var E = o.columns.records[F];
  2610. if (E.reseteverpresentrowwidgetvalue) {E.reseteverpresentrowwidgetvalue(E.displayfield, E.addnewrowwidget);}
  2611. }
  2612. C.hide();
  2613. o.focus();
  2614. o.updateeverpresentrow();
  2615. });
  2616. d.mousedown(function (F) {
  2617. var P = {};
  2618. var J = {};
  2619. for (var H = 0; H < z; H++) {
  2620. var G = o.columns.records[H];
  2621. if (!G.geteverpresentrowwidgetvalue) {continue;}
  2622. var M = G.geteverpresentrowwidgetvalue(G.displayfield, G.addnewrowwidget);
  2623. J[G.datafield] = M;
  2624. if (G.datafield != G.displayfield) {
  2625. J[G.datafield] = M.value;
  2626. J[G.displayfield] = M.label;
  2627. }
  2628. if (G.datafield != G.displayfield) {
  2629. J[G.datafield] = M.label;
  2630. J[G.displayfield] = M.value;
  2631. }
  2632. }
  2633. var L = false;
  2634. for (var H = 0; H < z; H++) {
  2635. var G = o.columns.records[H];
  2636. if (!G.geteverpresentrowwidgetvalue) {continue;}
  2637. var M = G.geteverpresentrowwidgetvalue(G.displayfield, G.addnewrowwidget);
  2638. if (G.createeverpresentrowwidget && G.validateeverpresentrowwidgetvalue) {
  2639. var K = G.validateeverpresentrowwidgetvalue(G.displayfield, M, J);
  2640. var O = K;
  2641. var I = o.gridlocalization.validationstring;
  2642. if (O.message != undefined) {I = O.message;}
  2643. var N = typeof O == "boolean" ? O : O.result;
  2644. if (!N) {
  2645. M = "invalid editor state";
  2646. G.addnewrowwidget.attr("title", I);
  2647. G.addnewrowwidget.addClass(o.toThemeProperty("jqx-input-invalid"));
  2648. } else {
  2649. G.addnewrowwidget.attr("title", "");
  2650. G.addnewrowwidget.removeClass(o.toThemeProperty("jqx-input-invalid"));
  2651. }
  2652. }
  2653. if (M === "invalid editor state") {
  2654. F.preventDefault();
  2655. F.stopPropagation();
  2656. L = true;
  2657. continue;
  2658. }
  2659. if (L) {continue;}
  2660. }
  2661. if (L) {
  2662. C.hide();
  2663. o.focus();
  2664. return;
  2665. }
  2666. for (var H = 0; H < z; H++) {
  2667. var G = o.columns.records[H];
  2668. if (!G.geteverpresentrowwidgetvalue) {continue;}
  2669. var M = G.geteverpresentrowwidgetvalue(G.displayfield, G.addnewrowwidget);
  2670. P[G.datafield] = M;
  2671. if (G.datafield != G.displayfield) {
  2672. J[G.datafield] = M.label;
  2673. J[G.displayfield] = M.value;
  2674. }
  2675. if (G.reseteverpresentrowwidgetvalue) {G.reseteverpresentrowwidgetvalue(G.displayfield, G.addnewrowwidget);}
  2676. }
  2677. var E = o.everpresentrowactions.indexOf("addBottom") >= 0 ? "last" : "first";
  2678. o.addrow(null, P, E);
  2679. C.hide();
  2680. o.focus();
  2681. });
  2682. p.mousedown(function (G) {
  2683. var H = {};
  2684. for (var F = 0; F < z; F++) {
  2685. var E = o.columns.records[F];
  2686. if (E.reseteverpresentrowwidgetvalue) {E.reseteverpresentrowwidgetvalue(E.displayfield, E.addnewrowwidget);}
  2687. if (E.addnewrowwidget) {
  2688. E.addnewrowwidget.attr("title", "");
  2689. E.addnewrowwidget.removeClass(o.toThemeProperty("jqx-input-invalid"));
  2690. }
  2691. }
  2692. C.hide();
  2693. o.focus();
  2694. });
  2695. for (var w = 0; w < z; w++) {
  2696. var x = o.columns.records[w];
  2697. var u = x.width;
  2698. if (u < x.minwidth) {u = x.minwidth;}
  2699. if (u > x.maxwidth) {u = x.maxwidth;}
  2700. var e = b('<div style="overflow: hidden; position: absolute; height: 100%;" class="' + n + '"></div>');
  2701. t.append(e);
  2702. e.css("left", i);
  2703. if (o.rtl) {
  2704. e.css("z-index", m++);
  2705. e.css("border-left-width", "1px");
  2706. } else {e.css("z-index", m--);}
  2707. if (u == "auto") {u = 0;}
  2708. e[0].style.width = parseFloat(u) + "px";
  2709. e[0].left = i;
  2710. if (!(x.hidden && x.hideable) && !x.adaptivehidden) {i += u;} else {e.css("display", "none");}
  2711. h[h.length] = e[0];
  2712. if (x.checkboxcolumn) {
  2713. var B = o.toThemeProperty("jqx-grid-cell");
  2714. B += " " + o.toThemeProperty("jqx-grid-cell-filter-row");
  2715. B += " " + o.toThemeProperty("jqx-grid-cell-pinned");
  2716. e.removeClass().addClass(B);
  2717. continue;
  2718. }
  2719. var s = true;
  2720. if (!o.rtl) {
  2721. if (o.groupable) {
  2722. var y = (o.showrowdetailscolumn && o.rowdetails) ? 1 : 0;
  2723. if (o.groups.length + y > w) {s = false;}
  2724. }
  2725. if (o.showrowdetailscolumn && o.rowdetails && w == 0) {s = false;}
  2726. } else {
  2727. if (o.groupable) {
  2728. var y = (o.showrowdetailscolumn && o.rowdetails) ? 1 : 0;
  2729. if (o.groups.length + y + w > z - 1) {s = false;}
  2730. }
  2731. if (o.showrowdetailscolumn && o.rowdetails && w == z - 1) {s = false;}
  2732. }
  2733. o.updateeverpresentrow = function () {
  2734. var G = null;
  2735. if (o.selectedcells.length > 0 || o.selectedrowindexes.length > 0) {
  2736. if (o.selectionmode.indexOf("cell") >= 0) {var H = o.getselectedcells()[0].rowindex;} else {var H = o.selectedrowindexes[0];}
  2737. G = o.getrowdata(H);
  2738. }
  2739. if (!G) {return;}
  2740. for (var F = 0; F < o.columns.records.length; F++) {
  2741. var j = o.columns.records[F];
  2742. if (j.seteverpresentrowwidgetvalue) {
  2743. var E = o.getcelltext(H, j.displayfield);
  2744. j.seteverpresentrowwidgetvalue(j.addnewrowwidget, E);
  2745. }
  2746. }
  2747. };
  2748. if (s) {
  2749. if (x.createeverpresentrowwidget) {
  2750. var v = function () {d.trigger("mousedown");};
  2751. x.addnewrowwidget = x.createeverpresentrowwidget(x.datafield, e, C, v);
  2752. if (x.initeverpresentrowwidget) {x.initeverpresentrowwidget(x.datafield, e, C);}
  2753. } else {
  2754. o._measureElement("column");
  2755. var r = (o.everpresentrowheight / 2 - o._columnheight / 2);
  2756. if (r < 0) {r = 6;}
  2757. r += "px";
  2758. if (x.datafield === "addButtonColumn") {
  2759. var l = b('<div style="padding-bottom: 2px; text-align: center; margin-top: ' + r + ';"><a href="#">' + o.gridlocalization.addrowstring + "</a></div>");
  2760. e.append(l);
  2761. l.mousedown(function () {d.trigger("mousedown");});
  2762. continue;
  2763. } else {
  2764. if (x.datafield === "resetButtonColumn") {
  2765. var l = b('<div style="padding-bottom: 2px; text-align: center; margin-top: ' + r + ';"><a href="#">' + o.gridlocalization.resetrowstring + "</a></div>");
  2766. e.append(l);
  2767. l.mousedown(function () {p.trigger("mousedown");});
  2768. continue;
  2769. }
  2770. }
  2771. var A = function (F, H, j) {
  2772. var E = b('<input style="box-sizing: border-box; padding-right: 4px; padding-left: 4px; border:none;" autocomplete="off" type="textarea"/>');
  2773. E[0].id = b.jqx.utilities.createId();
  2774. E.addClass(F.toThemeProperty("jqx-widget"));
  2775. E.addClass(F.toThemeProperty("jqx-input"));
  2776. E.addClass(F.toThemeProperty("jqx-widget-content"));
  2777. E.addClass(F.toThemeProperty("jqx-enableselect"));
  2778. E.addClass(F.toThemeProperty("jqx-grid-cell-add-new-row"));
  2779. E.css("text-align", j.cellsalign);
  2780. if (F.rtl) {E.css("direction", "rtl");}
  2781. if (F.disabled) {E.attr("disabled", true);}
  2782. E.attr("disabled", false);
  2783. E.attr("placeholder", F.gridlocalization.everpresentrowplaceholder + j.text);
  2784. E.appendTo(H);
  2785. E.css("width", "100%");
  2786. E.css("height", F.everpresentrowheight + "px");
  2787. E.css("line-height", F.everpresentrowheight + "px");
  2788. E.css("max-height", F.everpresentrowheight + "px");
  2789. E.css("margin", "0px");
  2790. E.focus(function () {
  2791. if (o.selectedcells.length > 0 || o.selectedrowindexes.length > 0) {if (o.selectionmode.indexOf("cell") >= 0) {var K = o.getselectedcells()[0].rowindex;} else {var K = o.selectedrowindexes[0];}}
  2792. E.addClass(F.toThemeProperty("jqx-fill-state-focus"));
  2793. var I = F.columns.records.indexOf(j);
  2794. if (F.everpresentrowactionsmode !== "columns") {C.css({ display: "block", top: E.coord().top + F.everpresentrowheight - 1, left: I > 0 ? E.coord().left : E.coord().left - 1 });}
  2795. var J = C.children().width();
  2796. if (j.cellsalign === "right") {
  2797. var J = d.width() + p.width();
  2798. C.children().css("left", J - J + "px");
  2799. } else {C.children().css("left", "0px");}
  2800. F.content[0].scrollLeft = 0;
  2801. F.content[0].scrollTop = 0;
  2802. setTimeout(function () {
  2803. F.content[0].scrollLeft = 0;
  2804. F.content[0].scrollTop = 0;
  2805. }, 50);
  2806. return false;
  2807. });
  2808. j.addnewrowwidget = E;
  2809. if (!j.reseteverpresentrowwidgetvalue) {
  2810. j.reseteverpresentrowwidgetvalue = function (J, I) {
  2811. I.val("");
  2812. I.focus();
  2813. I.blur();
  2814. I.removeClass(o.toThemeProperty("jqx-input-invalid"));
  2815. I.attr("title", "");
  2816. };
  2817. }
  2818. if (!j.seteverpresentrowwidgetvalue) {j.seteverpresentrowwidgetvalue = function (J, I) {J.val(I);};}
  2819. if (!j.geteverpresentrowwidgetvalue) {
  2820. var G = j;
  2821. j.geteverpresentrowwidgetvalue = function (I, P, R) {
  2822. var U = P.val();
  2823. if (R !== false && G.validateeverpresentrowwidgetvalue) {
  2824. var Y = {};
  2825. var O = {};
  2826. for (var M = 0; M < z; M++) {
  2827. var K = o.columns.records[M];
  2828. if (!K.geteverpresentrowwidgetvalue) {continue;}
  2829. var Q = K.geteverpresentrowwidgetvalue(K.displayfield, K.addnewrowwidget, false);
  2830. O[K.datafield] = Q;
  2831. if (K.datafield != K.displayfield) {
  2832. O[K.datafield] = Q.value;
  2833. O[K.displayfield] = Q.label;
  2834. }
  2835. }
  2836. var T = G.validateeverpresentrowwidgetvalue(G.displayfield, U, O);
  2837. var X = T;
  2838. var N = o.gridlocalization.validationstring;
  2839. if (X.message != undefined) {N = X.message;}
  2840. var W = typeof X == "boolean" ? X : X.result;
  2841. if (!W) {
  2842. E.addClass(o.toThemeProperty("jqx-input-invalid"));
  2843. E.attr("title", N);
  2844. return "invalid editor state";
  2845. } else {
  2846. E.removeClass(o.toThemeProperty("jqx-input-invalid"));
  2847. E.attr("title", "");
  2848. }
  2849. }
  2850. var S = "string";
  2851. var J = o.source.datafields || ((o.source._source) ? o.source._source.datafields : null);
  2852. if (J) {
  2853. var V = "";
  2854. b.each(J, function () {
  2855. if (this.name == G.displayfield) {
  2856. if (this.type) {V = this.type;}
  2857. return false;
  2858. }
  2859. });
  2860. if (V) {S = V;}
  2861. }
  2862. if (S === "number") {
  2863. var L = parseFloat(U);
  2864. if (isNaN(L)) {return null;}
  2865. }
  2866. if (S === "date") {return b.jqx.dataFormat.tryparsedate(U, o.gridlocalization);}
  2867. if (S === "bool" || S === "boolean") {
  2868. if (U === "true") {return true;}
  2869. if (U == "1") {return true;}
  2870. if (U === "false") {return false;}
  2871. if (U == "0") {return false;}
  2872. if (U === true) {return U;}
  2873. if (U === false) {return U;}
  2874. return false;
  2875. }
  2876. return U;
  2877. };
  2878. }
  2879. E.keydown(function (I) {if (I.keyCode === 13) {if (o.everpresentrowactions.indexOf("add") >= 0) {d.trigger("mousedown");} else {if (o.everpresentrowactions.indexOf("update") >= 0) {q.trigger("mousedown");} else {if (o.everpresentrowactions.indexOf("delete") >= 0) {k.trigger("mousedown");}}}}});
  2880. E.blur(function () {
  2881. E.removeClass(F.toThemeProperty("jqx-fill-state-focus"));
  2882. C.css("display", "none");
  2883. });
  2884. if (j.initeverpresentrowwidget) {j.initeverpresentrowwidget(j.datafield, H, C);}
  2885. };
  2886. A(this, e, x);
  2887. }
  2888. }
  2889. }
  2890. if (b.jqx.browser.msie && b.jqx.browser.version < 8) {t.css("z-index", m--);}
  2891. t.width(parseFloat(i) + 2);
  2892. f.addClass(n);
  2893. f.css("border-bottom-width", "0px");
  2894. if (o.showfilterrow) {f.css("border-top-width", "0px");} else {f.css("border-top-width", "1px");}
  2895. f.css("box-sizing", "border-box");
  2896. f.css("border-right-width", "0px");
  2897. },
  2898. _gettableheight: function () {
  2899. if (this.tableheight != undefined) {return this.tableheight;}
  2900. var e = this.host.height();
  2901. if (this.columnsheader) {
  2902. var d = this.columnsheader.outerHeight();
  2903. if (!this.showheader) {d = 0;}
  2904. }
  2905. e -= d;
  2906. if (this.hScrollBar[0].style.visibility == "visible") {e -= this.hScrollBar.outerHeight();}
  2907. if (this.pageable) {e -= this.pager.outerHeight();}
  2908. if (this._groupsheader()) {e -= this.groupsheader.outerHeight();}
  2909. if (this.showtoolbar) {e -= this.toolbarheight;}
  2910. if (this.showstatusbar) {e -= this.statusbarheight;}
  2911. if (this.showeverpresentrow && this.everpresentrowposition === "bottom") {e -= this.everpresentrowheight;}
  2912. if (e > 0) {
  2913. this.tableheight = e;
  2914. return e;
  2915. }
  2916. return this.host.height();
  2917. },
  2918. _getpagesize: function () {
  2919. if (this.pageable) {return this.pagesize;}
  2920. if (this.virtualmode) {
  2921. var e = Math.round(this.host.height()) + 2 * this.rowsheight;
  2922. var d = Math.round(e / this.rowsheight);
  2923. return d;
  2924. }
  2925. if (this.autoheight || this.autorowheight) {
  2926. if (this.dataview.totalrows == 0) {return 1;}
  2927. return this.dataview.totalrows;
  2928. }
  2929. if (this.dataview.totalrows < 100 && this.dataview.totalrecords < 100 && this.dataview.totalrows > 0) {return this.dataview.totalrows;}
  2930. return 100;
  2931. },
  2932. _calculatevirtualheight: function () {
  2933. var p = this.that;
  2934. var e = Math.round(this.host.height()) + 2 * this.rowsheight;
  2935. var k = this._gettableheight();
  2936. var r = Math.round(e / this.rowsheight);
  2937. this.heights = new Array();
  2938. this.hiddens = new Array();
  2939. this.details = new Array();
  2940. this.expandedgroups = new Array();
  2941. this.hiddenboundrows = new Array();
  2942. this.heightboundrows = new Array();
  2943. this.detailboundrows = new Array();
  2944. var h = Math.max(this.dataview.totalrows, this.dataview.totalrecords);
  2945. if (this.pageable) {
  2946. h = this.pagesize;
  2947. if (this.pagesize > Math.max(this.dataview.totalrows, this.dataview.totalrecords) && this.autoheight) {h = Math.max(this.dataview.totalrows, this.dataview.totalrecords);} else {if (!this.autoheight) {if (this.dataview.totalrows < this.pagesize) {h = Math.max(this.dataview.totalrows, this.dataview.totalrecords);}}}
  2948. }
  2949. var m = h * this.rowsheight;
  2950. var n = 0;
  2951. var j = 0;
  2952. var l = 0;
  2953. var f = this._getpagesize();
  2954. var d = f * this.rowsheight;
  2955. var g = 0;
  2956. if (!this.pageable && this.autoheight) {r = h;}
  2957. if (h + f > 0) {
  2958. while (g <= h + f) {
  2959. n += d;
  2960. if (g - f < h && g >= h) {
  2961. var q = g - h;
  2962. if (q > 0) {
  2963. l -= d;
  2964. this._pageviews[j - 1] = { top: l, height: d - q * this.rowsheight };
  2965. }
  2966. break;
  2967. } else {this._pageviews[j++] = { top: l, height: d };}
  2968. l = n;
  2969. g += f;
  2970. }
  2971. }
  2972. if (this.resizingGrid != true) {this.vScrollBar.jqxScrollBar({ value: 0 });}
  2973. if (this.hScrollBar.css("visibility") == "hidden") {
  2974. var o = 0;
  2975. if (this.columns && this.columns.records) {
  2976. for (var g = 0; g < this.columns.records.length; g++) {o += !isNaN(this.columns.records[g].width) ? this.columns.records[g].width : this.columns.records[g].minwidth;}
  2977. if (!isNaN(o) && parseInt(o) > this.host.width()) {k -= 30;}
  2978. }
  2979. }
  2980. if (m > k && !this.autoheight) {
  2981. this.vScrollBar.css("visibility", "visible");
  2982. if (this.scrollmode == "deferred") {this.vScrollBar.jqxScrollBar({ max: m });} else {this.vScrollBar.jqxScrollBar({ max: m - k });}
  2983. } else {this.vScrollBar.css("visibility", "hidden");}
  2984. this.dataview.pagesize = f;
  2985. this.dataview.updateview();
  2986. return { visiblerecords: r, virtualheight: m };
  2987. },
  2988. _updatepageviews: function () {
  2989. if (this.updating()) {return;}
  2990. this._pagescache = new Array();
  2991. this._pageviews = new Array();
  2992. this.tableheight = null;
  2993. var m = this.that;
  2994. var h = Math.round(this.host.height()) + 2 * this.rowsheight;
  2995. var w = Math.round(h / this.rowsheight);
  2996. var f = Math.max(this.dataview.totalrows, this.dataview.totalrecords);
  2997. var n = f * this.rowsheight;
  2998. var l = 0;
  2999. var q = 0;
  3000. var g = 0;
  3001. var p = 0;
  3002. var r = 0;
  3003. var o = this._getpagesize();
  3004. if (!this.pageable) {
  3005. for (var t = 0; t < f; t++) {
  3006. var d = { index: t, height: this.heights[t], hidden: this.hiddens[t], details: this.details[t] };
  3007. if (this.heights[t] == undefined) {
  3008. this.heights[t] = this.rowsheight;
  3009. d.height = this.rowsheight;
  3010. }
  3011. if (this.hiddens[t] == undefined) {
  3012. this.hiddens[t] = false;
  3013. d.hidden = false;
  3014. }
  3015. if (this.details[t] == undefined) {this.details[t] = null;}
  3016. if (d.height != m.rowsheight) {
  3017. n -= m.rowsheight;
  3018. n += d.height;
  3019. }
  3020. if (d.hidden) {n -= d.height;} else {
  3021. q += d.height;
  3022. var e = 0;
  3023. if (this.rowdetails) {
  3024. if (this.rowdetailstemplate) {
  3025. if (!d.details) {
  3026. var v = typeof this.rowdetailstemplate === "function" ? this.rowdetailstemplate() : this.rowdetailstemplate;
  3027. if (v.rowdetailshidden === undefined) {v.rowdetailshidden = true;}
  3028. if (v.rowdetailsheight === undefined) {v.rowdetailsheight = 200;}
  3029. if (v.rowdetails === undefined) {v.rowdetails = "<div></div>";}
  3030. d.details = v;
  3031. }
  3032. }
  3033. if (d.details && d.details.rowdetails && !d.details.rowdetailshidden) {
  3034. e = d.details.rowdetailsheight;
  3035. q += e;
  3036. n += e;
  3037. }
  3038. }
  3039. l += d.height + e;
  3040. }
  3041. r++;
  3042. if (r >= o || t == f - 1) {
  3043. this._pageviews[g++] = { top: p, height: q };
  3044. q = 0;
  3045. p = l;
  3046. r = 0;
  3047. }
  3048. }
  3049. } else {
  3050. if (this._updatepagedview) {n = this._updatepagedview(f, n, 0);}
  3051. if (this.autoheight) {this._arrange();}
  3052. }
  3053. var j = this._gettableheight();
  3054. if (n > j) {
  3055. if (this.pageable && this.gotopage) {
  3056. n = this._pageviews[0].height;
  3057. if (n < 0) {n = this._pageviews[0].height;}
  3058. }
  3059. if (this.vScrollBar.css("visibility") != "visible") {this.vScrollBar.css("visibility", "visible");}
  3060. if (n <= j || this.autoheight) {this.vScrollBar.css("visibility", "hidden");}
  3061. if (n - j > 0) {
  3062. if (this.scrollmode != "deferred") {
  3063. var s = n - j;
  3064. var u = this.vScrollInstance.max;
  3065. this.vScrollBar.jqxScrollBar({ max: s });
  3066. if (s != u) {this.vScrollBar.jqxScrollBar({ value: 0 });}
  3067. } else {this.vScrollBar.jqxScrollBar({ value: 0, max: n });}
  3068. } else {this.vScrollBar.jqxScrollBar({ value: 0, max: n });}
  3069. } else {
  3070. if (!this._loading) {this.vScrollBar.css("visibility", "hidden");}
  3071. this.vScrollBar.jqxScrollBar({ value: 0 });
  3072. }
  3073. this._arrange();
  3074. if (this.autoheight) {w = Math.round(this.host.height() / this.rowsheight);}
  3075. this.virtualsizeinfo = { visiblerecords: w, virtualheight: n };
  3076. },
  3077. updatebounddata: function (f) {
  3078. if (f != "data" && f != "sort" && f != "filter" && f != "cells" && f != "pagechanged" && f != "pagesizechanged" && !this.virtualmode) {
  3079. this.virtualsizeinfo = null;
  3080. if (this.columns && this.columns.records) {
  3081. for (var d = 0; d < this.columns.records.length; d++) {
  3082. var e = this.columns.records[d];
  3083. if (e.destroywidget && e.widget) {if (e.destroywidget) {e.destroywidget(e.widget);}}
  3084. }
  3085. }
  3086. if (this.showfilterrow && this.filterable && this.filterrow) {
  3087. if (this.clearfilters) {this.clearfilters(false);}
  3088. if (this.filterable && this._destroyedfilters && this.showfilterrow) {this._destroyedfilters();}
  3089. this.filterrow.remove();
  3090. this._filterrowcache = new Array();
  3091. this.filterrow = null;
  3092. } else {if (this.filterable) {if (this.clearfilters) {this.clearfilters(false);}}}
  3093. if (this.showeverpresentrow) {this._removeaddnewrow();}
  3094. this.detailsVisibility = new Array();
  3095. this.groupsVisibility = new Array();
  3096. if (this.groupable) {
  3097. this.dataview.groups = [];
  3098. this.groups = [];
  3099. }
  3100. if (this.pageable) {
  3101. this.pagenum = 0;
  3102. this.dataview.pagenum = 0;
  3103. }
  3104. if (this.sortable) {
  3105. this.sortcolumn = null;
  3106. this.sortdirection = "";
  3107. this.dataview.sortfielddirection = "";
  3108. this.dataview.clearsortdata();
  3109. }
  3110. }
  3111. this.databind(this.source, f);
  3112. },
  3113. refreshdata: function () {
  3114. this._refreshdataview();
  3115. this.render();
  3116. },
  3117. _updatevscrollbarmax: function () {
  3118. if (this._pageviews && this._pageviews.length > 0) {
  3119. var f = this._pageviews[0].height;
  3120. if (this.virtualmode || !this.pageable) {f = this.virtualsizeinfo.virtualheight;}
  3121. var e = this._gettableheight();
  3122. if (f > e) {
  3123. if (this.pageable && this.gotopage) {
  3124. f = this._pageviews[0].height;
  3125. if (f < 0) {f = this._pageviews[0].height;}
  3126. }
  3127. if (this.vScrollBar.css("visibility") != "visible") {this.vScrollBar.css("visibility", "visible");}
  3128. if (f <= e || this.autoheight) {this.vScrollBar.css("visibility", "hidden");}
  3129. if (f - e > 0) {
  3130. var d = f - e;
  3131. this.vScrollBar.jqxScrollBar({ max: d });
  3132. } else {this.vScrollBar.jqxScrollBar({ value: 0, max: f });}
  3133. } else {
  3134. this.vScrollBar.css("visibility", "hidden");
  3135. this.vScrollBar.jqxScrollBar({ value: 0 });
  3136. }
  3137. }
  3138. },
  3139. _refreshdataview: function () {this.dataview.refresh();},
  3140. refresh: function (d) {
  3141. if (d != true) {
  3142. if (b.jqx.isHidden(this.host)) {return;}
  3143. if (this.virtualsizeinfo != null) {
  3144. this._cellscache = new Array();
  3145. this._renderrows(this.virtualsizeinfo);
  3146. this._updatesize();
  3147. }
  3148. }
  3149. },
  3150. render: function () {this._render(true, true, true, true);},
  3151. invalidate: function () {
  3152. if (this.virtualsizeinfo) {
  3153. this._updatecolumnwidths();
  3154. this._updatecellwidths();
  3155. this._renderrows(this.virtualsizeinfo);
  3156. }
  3157. },
  3158. clear: function () {
  3159. this.databind(null);
  3160. this.render();
  3161. },
  3162. _preparecolumngroups: function () {
  3163. var o = this.columnsheight;
  3164. if (this.columngroups) {
  3165. this.columnshierarchy = new Array();
  3166. if (this.columngroups.length) {
  3167. var n = this;
  3168. for (var h = 0; h < this.columngroups.length; h++) {
  3169. this.columngroups[h].parent = null;
  3170. this.columngroups[h].groups = null;
  3171. }
  3172. for (var h = 0; h < this.columns.records.length; h++) {
  3173. this.columns.records[h].parent = null;
  3174. this.columns.records[h].groups = null;
  3175. }
  3176. var p = function (j) {
  3177. for (var u = 0; u < n.columngroups.length; u++) {
  3178. var v = n.columngroups[u];
  3179. if (v.name === j) {return v;}
  3180. }
  3181. return null;
  3182. };
  3183. for (var h = 0; h < this.columngroups.length; h++) {
  3184. var q = this.columngroups[h];
  3185. if (!q.groups) {q.groups = null;}
  3186. if (q.parentgroup) {
  3187. var s = p(q.parentgroup);
  3188. if (s) {
  3189. q.parent = s;
  3190. if (!s.groups) {s.groups = new Array();}
  3191. if (s.groups.indexOf(q) === -1) {s.groups.push(q);}
  3192. }
  3193. }
  3194. }
  3195. for (var h = 0; h < this.columns.records.length; h++) {
  3196. var q = this.columns.records[h];
  3197. if (q.columngroup) {
  3198. var s = p(q.columngroup);
  3199. if (s) {
  3200. if (!s.groups) {s.groups = new Array();}
  3201. q.parent = s;
  3202. if (s.groups.indexOf(q) === -1) {s.groups.push(q);}
  3203. }
  3204. }
  3205. }
  3206. var r = 0;
  3207. for (var h = 0; h < this.columns.records.length; h++) {
  3208. var q = this.columns.records[h];
  3209. var e = q;
  3210. q.level = 0;
  3211. while (e.parent) {
  3212. e = e.parent;
  3213. q.level++;
  3214. }
  3215. var e = q;
  3216. var d = q.level;
  3217. r = Math.max(r, q.level);
  3218. while (e.parent) {
  3219. e = e.parent;
  3220. if (e) {e.level = --d;}
  3221. }
  3222. }
  3223. var m = function (y) {
  3224. var x = new Array();
  3225. if (y.columngroup) {x.push(y);}
  3226. if (y.groups) {
  3227. for (var w = 0; w < y.groups.length; w++) {
  3228. if (y.groups[w].columngroup) {x.push(y.groups[w]);} else {
  3229. if (y.groups[w].groups) {
  3230. var v = m(y.groups[w]);
  3231. for (var u = 0; u < v.length; u++) {x.push(v[u]);}
  3232. }
  3233. }
  3234. }
  3235. }
  3236. return x;
  3237. };
  3238. for (var h = 0; h < this.columngroups.length; h++) {
  3239. var q = this.columngroups[h];
  3240. var f = m(q);
  3241. q.columns = f;
  3242. var k = new Array();
  3243. var t = 0;
  3244. for (var g = 0; g < f.length; g++) {
  3245. k.push(this.columns.records.indexOf(f[g]));
  3246. if (f[g].pinned) {t++;}
  3247. }
  3248. if (t != 0) {throw new Error("jqxGrid: Column Groups initialization Error. Please, check the initialization of the jqxGrid's columns array. The columns in a column group cannot be pinned.");}
  3249. k.sort(function (j, i) {
  3250. j = parseInt(j);
  3251. i = parseInt(i);
  3252. if (j < i) {return -1;}
  3253. if (j > i) {return 1;}
  3254. return 0;
  3255. });
  3256. for (var l = 1; l < k.length; l++) {
  3257. if (k[l] != k[l - 1] + 1) {
  3258. throw new Error("jqxGrid: Column Groups initialization Error. Please, check the initialization of the jqxGrid's columns array. The columns in a column group are expected to be siblings in the columns array.");
  3259. this.host.remove();
  3260. }
  3261. }
  3262. }
  3263. }
  3264. this.columngroupslevel = 1 + r;
  3265. o = this.columngroupslevel * this.columnsheight;
  3266. }
  3267. return o;
  3268. },
  3269. _render: function (k, j, l, e, f) {
  3270. if (this.dataview == null) {return;}
  3271. if (this._loading) {return;}
  3272. if (this._batchupdate) {return;}
  3273. if (b.jqx.isHidden(this.host)) {
  3274. var g = this;
  3275. if (g.___hiddenTimer) {
  3276. clearInterval(g.___hiddenTimer);
  3277. g.___hiddenTimer = null;
  3278. }
  3279. this.___hiddenTimer = setInterval(function () {
  3280. if (!b.jqx.isHidden(g.host)) {
  3281. clearInterval(g.___hiddenTimer);
  3282. g.render();
  3283. }
  3284. }, 300);
  3285. return;
  3286. }
  3287. //debugger;//luoyifan setEditRow 不会自动关闭编辑模式
  3288. //if (this.editcell != null && this.endcelledit) {this.endcelledit(this.editcell.row, this.editcell.column, true, false);}
  3289. //jqx-all 搜索以下内容
  3290. //if(this.editcell!=null&&this.endcelledit){this.endcelledit(this.editcell.row,this.editcell.column,true,false)}this.validationpopup=null;this._removeHandlers();this._addHandlers();this._initializeRows();
  3291. //替换为
  3292. ///*luoyifan-if(this.editcell!=null&&this.endcelledit){this.endcelledit(this.editcell.row,this.editcell.column,true,false)}*/this.validationpopup=null;this._removeHandlers();this._addHandlers();this._initializeRows();
  3293. this.validationpopup = null;
  3294. this._removeHandlers();
  3295. this._addHandlers();
  3296. this._initializeRows();
  3297. this._requiresupdate = j != undefined ? j : true;
  3298. this._newmax = null;
  3299. if (l) {
  3300. if (!this._requiresupdate) {if (e != false) {this._initmenu();}}
  3301. if (this.columns == null) {this.columns = new b.jqx.collection(this.element);} else {
  3302. var i = this;
  3303. if (this.columns && this.columns.name === "observableArray") {
  3304. this.columns.notifier = function (p) {
  3305. var n = function () {
  3306. i.columns = i._columns;
  3307. i.render();
  3308. };
  3309. switch (p.type) {
  3310. case"add":
  3311. n();
  3312. break;
  3313. case"update":
  3314. if (p.name === "index") {
  3315. i.beginupdate();
  3316. for (var o in p.newValue) {i.setcolumnproperty(p.newValue.datafield, o, p.newValue[o]);}
  3317. i.endupdate();
  3318. } else {
  3319. var m = p.path.split(".");
  3320. i.setcolumnproperty(i.columns[m[0]].datafield, p.name, p.newValue);
  3321. }
  3322. break;
  3323. case"delete":
  3324. n();
  3325. break;
  3326. }
  3327. };
  3328. }
  3329. if (this.columngroups && this.columngroups.name === "observableArray") {this.columngroups.notifier = function (m) {i.render();};}
  3330. this._initializeColumns();
  3331. }
  3332. }
  3333. this.tableheight = null;
  3334. this._pagescache = new Array();
  3335. this._pageviews = new Array();
  3336. this.visiblerows = new Array();
  3337. this.hittestinfo = new Array();
  3338. if (this._requiresupdate) {
  3339. this._clearcaches();
  3340. if (e == true) {this._initmenu();}
  3341. }
  3342. this.virtualsizeinfo = null;
  3343. this.prerenderrequired = true;
  3344. if ((this.groupable && this.groups.length > 0 && this.rowdetails) || (this.rowdetails)) {
  3345. if (this.gridcontent) {
  3346. this._rowdetailscache = new Array();
  3347. this._rowdetailselementscache = new Array();
  3348. this.detailboundrows = new Array();
  3349. this.details = new Array();
  3350. b.jqx.utilities.html(this.gridcontent, "");
  3351. this.gridcontent = null;
  3352. }
  3353. }
  3354. if (this.gridcontent) {if (this.editable && this._destroyeditors) {this._destroyeditors();}}
  3355. if (l) {
  3356. if (this.filterrow) {this.filterrow.detach();}
  3357. b.jqx.utilities.html(this.content, "");
  3358. this.columnsheader = this.columnsheader || b('<div style="overflow: hidden;"></div>');
  3359. this.columnsheader.remove();
  3360. this.columnsheader.addClass(this.toTP("jqx-widget-header"));
  3361. this.columnsheader.addClass(this.toTP("jqx-grid-header"));
  3362. } else {if (this.gridcontent) {b.jqx.utilities.html(this.gridcontent, "");}}
  3363. if (!this.showheader) {this.columnsheader.css("display", "none");} else {if (this.columnsheader) {this.columnsheader.css("display", "block");}}
  3364. this.gridcontent = this.gridcontent || b('<div style="width: 100%; overflow: hidden; position: absolute;"></div>');
  3365. this.gridcontent.remove();
  3366. var h = this.columnsheight;
  3367. h = this._preparecolumngroups();
  3368. if (this.showfilterrow && this.filterable) {
  3369. this.columnsheader.height(h + this.filterrowheight);
  3370. if (this.showeverpresentrow && this.everpresentrowposition !== "bottom") {this.columnsheader.height(h + this.filterrowheight + this.everpresentrowheight);}
  3371. } else {if (this.showeverpresentrow && this.everpresentrowposition !== "bottom") {this.columnsheader.height(h + this.everpresentrowheight);} else {this.columnsheader.height(h);}}
  3372. this.content.append(this.columnsheader);
  3373. this.content.append(this.gridcontent);
  3374. this._arrange();
  3375. if (this._initgroupsheader) {this._initgroupsheader();}
  3376. this.selectionarea = this.selectionarea || b("<div style='z-index: 99; visibility: hidden; position: absolute;'></div>");
  3377. this.selectionarea.addClass(this.toThemeProperty("jqx-grid-selectionarea"));
  3378. this.selectionarea.addClass(this.toThemeProperty("jqx-fill-state-pressed"));
  3379. this.content.append(this.selectionarea);
  3380. this.tableheight = null;
  3381. this.rendergridcontent(false, l);
  3382. if (this.groups.length > 0 && this.groupable) {
  3383. var d = this.vScrollBar[0].style.visibility;
  3384. this.suspendgroupevents = true;
  3385. if (this.collapseallgroups) {
  3386. if (!this.groupsexpandedbydefault) {
  3387. this.collapseallgroups(false);
  3388. this._updatescrollbarsafterrowsprerender();
  3389. } else {this.expandallgroups(false);}
  3390. }
  3391. if (this.vScrollBar[0].style.visibility != d) {
  3392. this._updatecolumnwidths();
  3393. this._updatecellwidths();
  3394. }
  3395. this.suspendgroupevents = false;
  3396. }
  3397. if (this.pageable && this.updatepagerdetails) {
  3398. this.updatepagerdetails();
  3399. if (this.autoheight) {this._updatepageviews();}
  3400. if (this.autorowheight) {
  3401. if (!this.autoheight) {this._updatepageviews();}
  3402. this._renderrows(this.virtualsizeinfo);
  3403. }
  3404. }
  3405. if (this.showaggregates && this._updateaggregates) {this._updateaggregates();}
  3406. this._addoverlayelement();
  3407. if (this.scrollmode == "deferred") {this._addscrollelement();}
  3408. if (this.showfilterrow && this.filterable && this.filterrow && (f == undefined || f == true)) {this._updatelistfilters(!l);}
  3409. if (this.rendered) {this.rendered("full");}
  3410. this.__isRendered = true;
  3411. },
  3412. _addoverlayelement: function () {
  3413. var d = b.jqx.utilities.getBrowser();
  3414. if ((d.browser == "msie" && parseInt(d.version) < 9) || this.isTouchDevice()) {
  3415. if (this._overlayElement) {this._overlayElement.remove();}
  3416. this._overlayElement = b("<div class='jqxgrid-overlay' style='visibility: hidden; position: absolute; width: 100%; height: 100%;'></div>");
  3417. this._overlayElement.css("background", "white");
  3418. this._overlayElement.css("z-index", 180);
  3419. this._overlayElement.css("opacity", 0.001);
  3420. if (this.isTouchDevice()) {
  3421. if (this.vScrollBar.css("visibility") !== "hidden" || this.hScrollBar.css("visibility") !== "hidden") {
  3422. var e = 0;
  3423. if (this.selectionmode == "checkbox") {e += 30;}
  3424. if (this.groupable || this.rowdetails) {this._overlayElement.css("left", 30 * (this.groups.length + (this.rowdetails ? 1 : 0)));}
  3425. var f = this._overlayElement.css("left");
  3426. this._overlayElement.css("left", f + e);
  3427. } else {if (this._overlayElement) {this._overlayElement.remove();}}
  3428. } else {this.content.prepend(this._overlayElement);}
  3429. }
  3430. this._updateTouchScrolling();
  3431. },
  3432. _addscrollelement: function () {
  3433. if (this._scrollelement) {this._scrollelement.remove();}
  3434. if (this._scrollelementoverlay) {this._scrollelementoverlay.remove();}
  3435. this._scrollelementoverlay = b("<div style='visibility: hidden; position: absolute; width: 100%; height: 100%;'></div>");
  3436. this._scrollelementoverlay.css("background", "black");
  3437. this._scrollelementoverlay.css("z-index", 1800);
  3438. this._scrollelementoverlay.css("opacity", 0.1);
  3439. this._scrollelement = b("<span style='visibility: hidden; top: 50%; right: 10px; position: absolute;'></span>");
  3440. this._scrollelement.css("z-index", 1900);
  3441. this._scrollelement.addClass(this.toThemeProperty("jqx-button"));
  3442. this._scrollelement.addClass(this.toThemeProperty("jqx-fill-state-normal"));
  3443. this._scrollelement.addClass(this.toThemeProperty("jqx-rc-all"));
  3444. this._scrollelement.addClass(this.toThemeProperty("jqx-shadow"));
  3445. this.content.prepend(this._scrollelement);
  3446. this.content.prepend(this._scrollelementoverlay);
  3447. },
  3448. _postrender: function (f) {
  3449. if (f == "filter" || f == "sort" || f == "group") {
  3450. if (this.rowdetails && this.detailsVisibility && this.detailsVisibility.length > 0) {
  3451. this._detailsUpdate = true;
  3452. for (var e = 0; e < this.details.length; e++) {if (this.details[e]) {this.details[e].rowdetailshidden = true;}}
  3453. for (var e = 0; e < this.detailsVisibility.length; e++) {if (false === this.detailsVisibility[e]) {this.showrowdetails(e);} else {if (true === this.detailsVisibility[e]) {this.hiderowdetails(e);}}}
  3454. this._detailsUpdate = false;
  3455. this.rendergridcontent(true);
  3456. this._updatecolumnwidths();
  3457. this._updatecellwidths();
  3458. this._renderrows(this.virtualsizeinfo);
  3459. }
  3460. }
  3461. if (this.groupable && this.groups.length > 0) {
  3462. if (f == "filter" || f == "sort") {
  3463. for (var e = 0; e < this.dataview.loadedgroups.length; e++) {
  3464. var h = this.dataview.loadedgroups[e];
  3465. var d = 0;
  3466. var k;
  3467. for (var g in this.groupsVisibility) {
  3468. if (g == h.group && this.groupsVisibility[g]) {
  3469. k = true;
  3470. this._setgroupstate(h, true, false);
  3471. d++;
  3472. }
  3473. }
  3474. if (d > 0) {
  3475. k = false;
  3476. var j = this.vScrollBar[0].style.visibility;
  3477. this.rendergridcontent(true, false);
  3478. if (j != this.vScrollBar[0].style.visibility || this._hiddencolumns) {
  3479. this._updatecolumnwidths();
  3480. this._updatecellwidths();
  3481. this._renderrows(this.virtualsizeinfo);
  3482. }
  3483. }
  3484. }
  3485. } else {if (f == "group") {this.groupsVisibility = new Array();}}
  3486. }
  3487. },
  3488. rendergridcontent: function (e, g) {
  3489. if (this.updating()) {return false;}
  3490. if (e == undefined || e == null) {e = false;}
  3491. this._requiresupdate = e;
  3492. var i = this.prerenderrequired;
  3493. if (this.prerenderrequired) {this._arrange();}
  3494. var h = this.that;
  3495. var g = g;
  3496. if (g == null || g == undefined) {g = true;}
  3497. this.tableheight = null;
  3498. h.virtualsizeinfo = h.virtualsizeinfo || h._calculatevirtualheight();
  3499. if (h.pageable && !h.autoheight) {if (h.dataview.totalrows < h.pagesize) {h._requiresupdate = true;}}
  3500. if (g) {h._rendercolumnheaders();} else {
  3501. if (this._rendersortcolumn) {this._rendersortcolumn();}
  3502. if (this._renderfiltercolumn) {this._renderfiltercolumn();}
  3503. }
  3504. h._renderrows(h.virtualsizeinfo);
  3505. if (this.gridcontent) {
  3506. if (this.gridcontent[0].scrollTop != 0) {this.gridcontent[0].scrollTop = 0;}
  3507. if (this.gridcontent[0].scrollLeft != 0) {this.gridcontent[0].scrollLeft = 0;}
  3508. }
  3509. if (i) {
  3510. var f = this.tableheight;
  3511. this._arrange();
  3512. if (f != this.tableheight && this.autoheight) {h._renderrows(h.virtualsizeinfo);}
  3513. }
  3514. if (this.rtl) {this._renderhorizontalscroll();}
  3515. if (this.autosavestate) {if (this.initializedcall != null) {if (this.savestate) {this.savestate();}}}
  3516. if (this.adaptive && this.element.offsetWidth <= this.adaptivewidth) {
  3517. var d = 0;
  3518. var j = h.element.offsetWidth - 2;
  3519. b.each(this.columns.records, function (k, l) {
  3520. d += this.width;
  3521. if (this.columntype === "adaptive") {return true;}
  3522. if (d >= j) {this.adaptivehidden = true;}
  3523. });
  3524. this._updatecolumnwidths();
  3525. this._updatecellwidths();
  3526. this._renderrows(this.virtualsizeinfo);
  3527. }
  3528. return true;
  3529. },
  3530. _updatecolumnwidths: function () {
  3531. var p = this.host.width();
  3532. var f = p;
  3533. var n = "";
  3534. if (this.columns == undefined || this.columns.records == undefined) {return;}
  3535. var u = this.that;
  3536. var h = this.rowdetails && this.showrowdetailscolumn ? (1 + this.groups.length) * this.groupindentwidth : (this.groups.length) * this.groupindentwidth;
  3537. var m = this.adaptive && this.element.offsetWidth <= this.adaptivewidth;
  3538. var e = 0;
  3539. if (m) {
  3540. var t = 1;
  3541. b.each(this.columns.records, function (q, v) {if (this.adaptivehidden) {t++;}});
  3542. var l = this.vScrollBar[0].offsetWidth > 0 ? this.vScrollBar[0].offsetWidth + 4 : 0;
  3543. if (this.vScrollBar.css("visibility") == "hidden") {l = 0;}
  3544. var k = this.columns.records.length - t;
  3545. e = (this.element.offsetWidth - 32 - l) / k;
  3546. }
  3547. b.each(this.columns.records, function (v, x) {
  3548. if (!(this.hidden && this.hideable) && !this.adaptivehidden) {
  3549. if (this.width.toString().indexOf("%") != -1 || this._percentagewidth != undefined) {
  3550. var x = 0;
  3551. var y = u.vScrollBar[0].style.visibility == "hidden" ? 0 : u.scrollbarsize + 5;
  3552. if (u.scrollbarautoshow || u.scrollbarsize == 0) {y = 0;}
  3553. var q = f;
  3554. x = parseFloat(this.width) * q / 100;
  3555. y += h;
  3556. if (this._percentagewidth != undefined) {x = parseFloat(this._percentagewidth) * (q - y) / 100;}
  3557. if (x < this.minwidth && this.minwidth != "auto") {x = this.minwidth;}
  3558. if (x > this.maxwidth && this.maxwidth != "auto") {x = this.maxwidth;}
  3559. p -= x;
  3560. } else {if (this.width != "auto" && !this._width) {p -= this.width;} else {n += this.text;}}
  3561. }
  3562. });
  3563. var g = this._gettableheight();
  3564. if (!this.autoheight) {
  3565. if (this.virtualsizeinfo && this.virtualsizeinfo.virtualheight > g) {
  3566. if (this.groupable && this.groups.length > 0) {
  3567. if (this.dataview && this.dataview.loadedrootgroups && !this.groupsexpandedbydefault) {
  3568. var s = this.dataview.loadedrootgroups.length * this.rowsheight;
  3569. if (this.pageable) {for (var d = 0; d < this.dataview.rows.length; d++) {if (this.dataview.rows[d].group && this.dataview.rows[d].level === 0) {s += this.rowsheight;}}}
  3570. if (s > g) {
  3571. p -= this.scrollbarsize + 5;
  3572. f -= this.scrollbarsize + 5;
  3573. } else {
  3574. if (this.vScrollBar.css("visibility") == "visible") {
  3575. p -= this.scrollbarsize + 5;
  3576. f -= this.scrollbarsize + 5;
  3577. }
  3578. }
  3579. } else {
  3580. p -= this.scrollbarsize + 5;
  3581. f -= this.scrollbarsize + 5;
  3582. }
  3583. } else {
  3584. if (this.vScrollBar.css("visibility") != "hidden" && this.scrollbarsize > 0) {
  3585. p -= this.scrollbarsize + 5;
  3586. f -= this.scrollbarsize + 5;
  3587. }
  3588. }
  3589. }
  3590. }
  3591. var h = this.rowdetails && this.showrowdetailscolumn ? (1 + this.groups.length) * this.groupindentwidth : (this.groups.length) * this.groupindentwidth;
  3592. f -= h;
  3593. if (!this.columnsheader) {return;}
  3594. var j = this.columnsheader.find("#columntable" + this.element.id);
  3595. if (j.length == 0) {return;}
  3596. var i = 0;
  3597. var o = this;
  3598. var r = 0;
  3599. b.each(this.columns.records, function (w, A) {
  3600. var y = b(this.element);
  3601. if (!this.hidden && !this.adaptivehidden && this.element.style.display === "none") {this.element.style.display = "block";}
  3602. if (this.adaptivehidden) {this.element.style.display = "none";}
  3603. var v = false;
  3604. var z = this.width;
  3605. if (this.width.toString().indexOf("%") != -1 || this._percentagewidth != undefined) {
  3606. if (this._percentagewidth != undefined) {z = parseFloat(this._percentagewidth) * f / 100;} else {z = parseFloat(this.width) * f / 100;}
  3607. v = true;
  3608. }
  3609. if (e > 0 && this.columntype !== "adaptive") {
  3610. y.width(e);
  3611. this.adaptivewidth = e;
  3612. } else {
  3613. if (this.width != "auto" && !this._width && !v) {if (parseInt(y[0].style.width) != this.width) {y.width(this.width);}} else {
  3614. if (v) {
  3615. if (z < this.minwidth && this.minwidth != "auto") {
  3616. z = this.minwidth;
  3617. this.width = z;
  3618. }
  3619. if (z > this.maxwidth && this.maxwidth != "auto") {
  3620. z = this.maxwidth;
  3621. this.width = z;
  3622. }
  3623. if (parseInt(y[0].style.width) != z) {
  3624. y.width(z);
  3625. this.width = z;
  3626. }
  3627. } else {
  3628. var x = Math.floor(p * (this.text.length / n.length));
  3629. r += x;
  3630. if (p - r < 3 && p != r && p - r > 0.01) {if (p - r === 1) {x++;} else {x += 2;}} else {if (w == u.columns.records.length - 1) {if (r < p) {x += (p - r);}}}
  3631. if (isNaN(x)) {x = this.minwidth;}
  3632. if (isNaN(x)) {x = this.minwidth;}
  3633. if (x == Infinity) {x = 0;}
  3634. if (x < 0) {
  3635. var q = b("<span>" + this.text + "</span>");
  3636. b(document.body).append(q);
  3637. x = 10 + q.width();
  3638. q.remove();
  3639. }
  3640. if (x < this.minwidth) {x = this.minwidth;}
  3641. if (x > this.maxwidth) {x = this.maxwidth;}
  3642. this._width = "auto";
  3643. this.width = x;
  3644. y.width(this.width);
  3645. }
  3646. }
  3647. }
  3648. if (parseInt(y[0].style.left) != i) {y.css("left", i);}
  3649. if (!(this.hidden && this.hideable) && !this.adaptivehidden) {if (e > 0 && this.columntype !== "adaptive") {i += e;} else {i += this.width;}}
  3650. this._requirewidthupdate = true;
  3651. });
  3652. this.columnsheader.width(2 + i);
  3653. j.width(this.columnsheader.width());
  3654. if (i == 0) {this.columnsheader[0].style.visibility = "hidden";} else {this.columnsheader[0].style.visibility = "inherit";}
  3655. this._resizecolumngroups();
  3656. if (this.showfilterrow && this.filterrow) {
  3657. this.filterrow.width(this.columnsheader.width());
  3658. this._updatefilterrowui();
  3659. }
  3660. if (this.showeverpresentrow) {
  3661. if (this.everpresentrowposition !== "bottom") {this.addnewrowtop.width(this.columnsheader.width());} else {this.addnewrowbottom.width(this.columnsheader.width());}
  3662. this._updateaddnewrowui();
  3663. }
  3664. if (this.autowidth) {this._arrange();}
  3665. },
  3666. _rendercolumnheaders: function () {
  3667. var x = this.that;
  3668. if (!this.prerenderrequired) {
  3669. if (this._rendersortcolumn) {this._rendersortcolumn();}
  3670. if (this._renderfiltercolumn) {this._renderfiltercolumn();}
  3671. if (this.showfilterrow && this.filterrow) {
  3672. this.filterrow.width(this.columnsheader.width());
  3673. this._updatefilterrowui();
  3674. }
  3675. if (this.showeverpresentrow) {
  3676. if (this.everpresentrowposition !== "bottom") {this.addnewrowtop.width(this.columnsheader.width());} else {this.addnewrowbottom.width(this.columnsheader.width());}
  3677. this._updateaddnewrowui();
  3678. }
  3679. return;
  3680. }
  3681. this._columnsbydatafield = new Array();
  3682. this.columnsheader.find("#columntable" + this.element.id).remove();
  3683. var o = b('<div id="columntable' + this.element.id + '" style="height: 100%; position: relative;"></div>');
  3684. o[0].cells = new Array();
  3685. var B = 0;
  3686. var h = 0;
  3687. var u = "";
  3688. var G = this.host.width();
  3689. var s = G;
  3690. var g = new Array();
  3691. var A = new Array();
  3692. var t = this.rowdetails && this.showrowdetailscolumn ? (1 + this.groups.length) * this.groupindentwidth : (this.groups.length) * this.groupindentwidth;
  3693. b.each(this.columns.records, function (j, k) {
  3694. if (!(this.hidden && this.hideable) && !this.adaptivehidden) {
  3695. if (this.width != "auto" && !this._width) {
  3696. if (this.width < this.minwidth && this.minwidth != "auto") {G -= this.minwidth;} else {
  3697. if (this.width > this.maxwidth && this.maxwidth != "auto") {G -= this.maxwidth;} else {
  3698. if (this.width.toString().indexOf("%") != -1) {
  3699. var k = 0;
  3700. var p = x.vScrollBar[0].style.visibility == "hidden" ? 0 : x.scrollbarsize + 5;
  3701. p += t;
  3702. k = parseFloat(this.width) * (s - p) / 100;
  3703. if (k < this.minwidth && this.minwidth != "auto") {k = this.minwidth;}
  3704. if (k > this.maxwidth && this.maxwidth != "auto") {k = this.maxwidth;}
  3705. G -= k;
  3706. } else {
  3707. if (typeof this.width == "string") {this.width = parseInt(this.width);}
  3708. G -= this.width;
  3709. }
  3710. }
  3711. }
  3712. } else {u += this.text;}
  3713. }
  3714. if (this.pinned || this.grouped || this.checkboxcolumn) {
  3715. if (x._haspinned) {this.pinned = true;}
  3716. g[g.length] = this;
  3717. } else {A[A.length] = this;}
  3718. });
  3719. if (!this.rtl) {
  3720. for (var D = 0; D < g.length; D++) {this.columns.replace(D, g[D]);}
  3721. for (var C = 0; C < A.length; C++) {this.columns.replace(g.length + C, A[C]);}
  3722. } else {
  3723. var y = 0;
  3724. g.reverse();
  3725. for (var D = this.columns.records.length - 1; D >= this.columns.records.length - g.length; D--) {this.columns.replace(D, g[y++]);}
  3726. for (var C = 0; C < A.length; C++) {this.columns.replace(C, A[C]);}
  3727. }
  3728. var n = this.headerZIndex;
  3729. var r = x.groupable ? x.groups.length : 0;
  3730. if (this.rowdetails && this.showrowdetailscolumn) {r++;}
  3731. var l = x.columnsheader.height();
  3732. if (this.showfilterrow) {if (!this.columngroups) {l = this.columnsheight;} else {l -= this.filterrowheight;}}
  3733. if (this.showeverpresentrow && this.everpresentrowposition !== "bottom") {if (!this.columngroups) {l = this.columnsheight;} else {l -= this.everpresentrowheight;}}
  3734. var v = this._gettableheight();
  3735. if (this.virtualsizeinfo && this.virtualsizeinfo.virtualheight > v && !this.scrollbarautoshow) {
  3736. if (this.groupable && this.groups.length > 0) {
  3737. if (this.dataview && this.dataview.loadedrootgroups && !this.groupsexpandedbydefault) {
  3738. var E = 0;
  3739. if (!this.pageable) {var E = this.dataview.loadedrootgroups.length * this.rowsheight;} else {if (this.pageable) {for (var w = 0; w < this.dataview.rows.length; w++) {if (this.dataview.rows[w].group && this.dataview.rows[w].level === 0) {E += this.rowsheight;}}}}
  3740. if (E > v) {
  3741. G -= this.scrollbarsize + 5;
  3742. s -= this.scrollbarsize + 5;
  3743. }
  3744. } else {
  3745. G -= this.scrollbarsize + 5;
  3746. s -= this.scrollbarsize + 5;
  3747. }
  3748. } else {
  3749. if (!this.autoheight && this.scrollbarsize > 0) {
  3750. G -= this.scrollbarsize + 5;
  3751. s -= this.scrollbarsize + 5;
  3752. }
  3753. }
  3754. }
  3755. s -= t;
  3756. var d = function (j, k) {
  3757. var i = x.columngroupslevel * x.columnsheight;
  3758. i = i - (k.level * x.columnsheight);
  3759. return i;
  3760. };
  3761. var f = document.createDocumentFragment();
  3762. var z = 0;
  3763. b.each(this.columns.records, function (X, V) {
  3764. this.height = x.columnsheight;
  3765. if (x.columngroups) {
  3766. if (x.columngroups.length) {
  3767. this.height = d(this.datafield, this);
  3768. l = this.height;
  3769. }
  3770. }
  3771. var ab = x.toTP("jqx-grid-column-header") + " " + x.toTP("jqx-widget-header");
  3772. if (x.rtl) {ab += " " + x.toTP("jqx-grid-column-header-rtl");}
  3773. var Z = !x.rtl ? 150 + n - 1 : 150 + n + 1;
  3774. var T = !x.rtl ? n-- : n++;
  3775. var H = b('<div role="columnheader" style="z-index: ' + T + ';position: absolute; height: 100%;" class="' + ab + '"><div style="height: 100%; width: 100%;"></div></div>');
  3776. if (x.columngroups) {
  3777. H[0].style.height = l + "px";
  3778. H[0].style.bottom = "0px";
  3779. if (this.pinned) {H[0].style.zIndex = Z;}
  3780. }
  3781. this.uielement = H;
  3782. if (this.classname != "" && this.classname) {H.addClass(this.classname);}
  3783. var P = this.width;
  3784. var Q = false;
  3785. if (this.width === null) {this.width = "auto";}
  3786. if (this.width.toString().indexOf("%") != -1 || this._percentagewidth != undefined) {
  3787. if (this._percentagewidth != undefined) {P = parseFloat(this._percentagewidth) * s / 100;} else {P = parseFloat(this.width) * s / 100;}
  3788. Q = true;
  3789. }
  3790. if (this.width != "auto" && !this._width && !Q) {
  3791. if (P < this.minwidth && this.minwidth != "auto") {
  3792. P = this.minwidth;
  3793. this.width = P;
  3794. }
  3795. if (P > this.maxwidth && this.maxwidth != "auto") {
  3796. P = this.maxwidth;
  3797. this.width = P;
  3798. }
  3799. H[0].style.width = parseInt(P) + "px";
  3800. } else {
  3801. if (Q) {
  3802. if (P < this.minwidth && this.minwidth != "auto") {P = this.minwidth;}
  3803. if (P > this.maxwidth && this.maxwidth != "auto") {P = this.maxwidth;}
  3804. if (this._percentagewidth == undefined || this.width.toString().indexOf("%") != -1) {this._percentagewidth = this.width;}
  3805. H.width(P);
  3806. this.width = P;
  3807. } else {
  3808. if (!this.hidden && !this.adaptivehidden) {
  3809. var U = Math.floor(G * (this.text.length / u.length));
  3810. z += U;
  3811. if (G - z < 3 && G != z && G - z > 0.01) {if (G - z === 1) {U++;} else {U += 2;}} else {if (X == x.columns.records.length - 1) {if (z < G) {U += (G - z);}}}
  3812. if (isNaN(U)) {U = this.minwidth;}
  3813. if (U < 0) {
  3814. var S = b("<span>" + this.text + "</span>");
  3815. b(document.body).append(S);
  3816. U = 10 + S.width();
  3817. S.remove();
  3818. }
  3819. if (U < this.minwidth) {U = this.minwidth;}
  3820. if (U > this.maxwidth) {U = this.maxwidth;}
  3821. this._width = "auto";
  3822. this.width = U;
  3823. P = this.width;
  3824. H.width(this.width);
  3825. }
  3826. }
  3827. }
  3828. if ((this.hidden && this.hideable) || this.adaptivehidden) {H.css("display", "none");}
  3829. var p = b(H.children()[0]);
  3830. var Y = x.rtl ? x.toTP("jqx-grid-column-menubutton") + " " + x.toTP("jqx-grid-column-menubutton-rtl") : x.toTP("jqx-grid-column-menubutton");
  3831. Y += " " + x.toTP("jqx-icon-arrow-down");
  3832. var K = b('<div style="height: ' + l + 'px; display: none; left: 100%; top: 0%; position: absolute;"><div class="' + Y + '" style="width: 100%; height:100%;"></div></div>');
  3833. if (!x.enableanimations) {K.css("margin-left", -16);}
  3834. if (x.rtl) {K.css("left", "0px");}
  3835. this.columnsmenu = K[0];
  3836. o[0].cells[X] = H[0];
  3837. K[0].style.width = parseInt(x.columnsmenuwidth) + "px";
  3838. var J = x.columnsmenu;
  3839. var q = false;
  3840. var W = false;
  3841. var R = (x.groupable && r > 0 && B < r) || (x.rowdetails && B < r);
  3842. if (x.rtl) {
  3843. R = (x.groupable && r > 0 && B < r) || (x.rowdetails && B < r);
  3844. R &= X > x.columns.records.length - 1 - r;
  3845. }
  3846. if (R) {
  3847. B++;
  3848. J &= false;
  3849. this.sortable = false;
  3850. this.editable = false;
  3851. W = true;
  3852. } else {
  3853. var M = this.renderer != null ? this.renderer(this.text, this.align, l) : x._rendercolumnheader(this.text, this.align, l, x);
  3854. if (M == null) {M = x._rendercolumnheader(this.text, this.align, l, x);}
  3855. if (this.renderer != null) {M = b(M);}
  3856. J &= true;
  3857. q = true;
  3858. }
  3859. if (x.WinJS) {MSApp.execUnsafeLocalFunction(function () {p.append(b(M));});} else {if (this.renderer) {p.append(b(M));} else {if (M) {p[0].innerHTML = M;}}}
  3860. if (M != null) {
  3861. var O = b('<div class="iconscontainer" style="height: ' + l + 'px; margin-left: -32px; display: block; position: absolute; left: 100%; top: 0%; width: 32px;"><div class="filtericon ' + x.toTP("jqx-widget-header") + '" style="height: ' + l + 'px; float: right; display: none; width: 16px;"><div class="' + x.toTP("jqx-grid-column-filterbutton") + '" style="width: 100%; height:100%;"></div></div><div class="sortasc ' + x.toTP("jqx-widget-header") + '" style="height: ' + l + 'px; float: right; display: none; width: 16px;"><div class="' + x.toTP("jqx-grid-column-sortascbutton") + " " + x.toTP("jqx-icon-arrow-up") + '" style="width: 100%; height:100%;"></div></div><div class="sortdesc ' + x.toTP("jqx-widget-header") + '" style="height: ' + l + 'px; float: right; display: none; width: 16px;"><div class="' + x.toTP("jqx-grid-column-sortdescbutton") + " " + x.toTP("jqx-icon-arrow-down") + '" style="width: 100%; height:100%;"></div></div><div class="sorticon ' + x.toTP("jqx-widget-header") + '" style="height: ' + l + 'px; float: right; visibility: hidden; width: 16px;"><div class="' + x.toTP("jqx-grid-column-sorticon") + " " + x.toTP("jqx-icon-arrow-down") + '" style="width: 100%; height:100%;"></div></div></div>');
  3862. K.addClass(x.toTP("jqx-widget-header"));
  3863. p.append(O);
  3864. var ad = O.children();
  3865. this.sorticon = ad[3];
  3866. this.sortasc = ad[1];
  3867. this.sortdesc = ad[2];
  3868. this.filtericon = ad[0];
  3869. this.iconscontainer = O;
  3870. if (x.rtl) {
  3871. O.css("margin-left", "0px");
  3872. O.css("left", "0px");
  3873. b(this.sorticon).css("float", "left");
  3874. b(this.sortasc).css("float", "left");
  3875. b(this.filtericon).css("float", "left");
  3876. b(this.sortdesc).css("float", "left");
  3877. }
  3878. if (!x.autoshowfiltericon && this.filterable) {b(this.filtericon).css("display", "block");}
  3879. }
  3880. this.element = H[0];
  3881. if (J) {
  3882. x._handlecolumnsmenu(x, p, H, K, this);
  3883. if (!this.menu) {K.hide();}
  3884. }
  3885. f.appendChild(H[0]);
  3886. if (x.groupable && q) {
  3887. H[0].id = x.dataview.generatekey();
  3888. if (x._handlecolumnstogroupsdragdrop) {x._handlecolumnstogroupsdragdrop(this, H);} else {throw new Error("jqxGrid: Missing reference to jqxgrid.grouping.js.");}
  3889. }
  3890. if (x.columnsreorder && this.draggable && x._handlecolumnsdragreorder) {x._handlecolumnsdragreorder(this, H);}
  3891. var aa = this;
  3892. aa._applyStyle();
  3893. x.addHandler(H, "mouseenter", function (i) {
  3894. aa.hovered = true;
  3895. aa._applyStyle();
  3896. });
  3897. x.addHandler(H, "mouseleave", function (i) {
  3898. aa.hovered = false;
  3899. aa._applyStyle();
  3900. });
  3901. var ac = function (aj, ae, ak) {
  3902. if (aj.selectable) {
  3903. var am = x.getrows();
  3904. if (aj.selected === undefined) {aj.selected = false;}
  3905. if (!ae.shiftKey || x._clickedcolumn === undefined) {x._clickedcolumn = aj;}
  3906. if (ae.shiftKey && x._clickedcolumn && ak === undefined) {
  3907. var al = x.columns.records.indexOf(x._clickedcolumn);
  3908. var ai = x.columns.records.indexOf(aj);
  3909. var af = Math.min(al, ai);
  3910. var ag = Math.max(al, ai);
  3911. x.clearselection();
  3912. for (var ah = af; ah <= ag; ah++) {ac(x.columns.records[ah], ae, true);}
  3913. x._renderrows(this.virtualsizeinfo);
  3914. return;
  3915. }
  3916. if (ak) {aj.selected = true;} else {
  3917. if (!ae.ctrlKey) {x.clearselection();}
  3918. aj.selected = !aj.selected;
  3919. }
  3920. for (var ah = 0; ah < am.length; ah++) {x._applycellselection(am[ah].boundindex, aj.displayfield, aj.selected, false);}
  3921. if (aj.selected) {aj.element.setAttribute("selected", "");} else {aj.element.removeAttribute("selected");}
  3922. aj._applyStyle();
  3923. if (ak === undefined) {x._renderrows(this.virtualsizeinfo);}
  3924. }
  3925. };
  3926. x.addHandler(H, "click", function (i) {
  3927. if (aa.checkboxcolumn) {return true;}
  3928. if (x.sorttogglestates > 0 && x._togglesort) {
  3929. if (!x._loading) {
  3930. if (x.suspendClick) {return true;}
  3931. x._togglesort(aa);
  3932. }
  3933. }
  3934. ac(aa, i);
  3935. i.preventDefault();
  3936. x._raiseEvent(7, { column: aa.getcolumnproperties(), datafield: aa.datafield, originalEvent: i });
  3937. });
  3938. if (aa.resizable && x.columnsresize && !W) {
  3939. var I = false;
  3940. var j = "mousemove";
  3941. if (x.isTouchDevice() && x.touchmode !== true) {
  3942. I = true;
  3943. j = b.jqx.mobile.getTouchEventName("touchstart");
  3944. }
  3945. x.addHandler(H, j, function (ae) {
  3946. var i = parseInt(ae.pageX);
  3947. var ag = 5;
  3948. var aj = parseInt(H.coord().left);
  3949. if (x.hasTransform) {aj = b.jqx.utilities.getOffset(H).left;}
  3950. if (x.resizing) {return true;}
  3951. if (x._handlecolumnsresize) {
  3952. if (I) {
  3953. var af = x.getTouches(ae);
  3954. var ai = af[0];
  3955. i = ai.pageX;
  3956. ag = 40;
  3957. if (i >= aj + aa.width - ag) {
  3958. x.resizablecolumn = { columnelement: H, column: aa };
  3959. H.css("cursor", "col-resize");
  3960. } else {
  3961. H.css("cursor", "");
  3962. x.resizablecolumn = null;
  3963. }
  3964. return true;
  3965. }
  3966. var ah = aa.width;
  3967. if (x.rtl) {ah = 0;}
  3968. if (i >= aj + ah - ag) {
  3969. if (i <= aj + ah + ag) {
  3970. x.resizablecolumn = { columnelement: H, column: aa };
  3971. H.css("cursor", "col-resize");
  3972. return false;
  3973. } else {
  3974. H.css("cursor", "");
  3975. x.resizablecolumn = null;
  3976. }
  3977. } else {
  3978. H.css("cursor", "");
  3979. if (i < aj + ah - ag) {if (!aa._animating && !aa._menuvisible) {H.mouseenter();}}
  3980. x.resizablecolumn = null;
  3981. }
  3982. }
  3983. });
  3984. }
  3985. H.css("left", h);
  3986. if (!(this.hidden && this.hideable) && !this.adaptivehidden) {h += P;}
  3987. if (aa.rendered) {
  3988. var N = aa.rendered(b(p[0].firstChild), aa.align, l);
  3989. if (N && O != null) {O.hide();}
  3990. }
  3991. if (aa.checkboxcolumn) {
  3992. if (O) {O.hide();}
  3993. if (!x.host.jqxCheckBox) {throw new Error("jqxGrid: Missing reference to jqxcheckbox.js");}
  3994. p.html('<div style="cursor: pointer; margin-left: 3px; top: 50%; margin-top: -9px; position: relative;"></div>');
  3995. var k = p.find("div:first");
  3996. k.jqxCheckBox({ _canFocus: false, disabled: x.disabled, disabledContainer: true, theme: x.theme, enableContainerClick: false, animationShowDelay: 0, animationHideDelay: 0 });
  3997. k.addClass(x.toThemeProperty("jqx-checkbox"));
  3998. aa.checkboxelement = k;
  3999. var L = k.data().jqxCheckBox.instance;
  4000. x._checkboxcolumn = aa;
  4001. L.updated = function (ae, i, af) {
  4002. x._checkboxcolumnupdating = true;
  4003. if (x.disabled) {
  4004. k.jqxCheckBox({ disabled: x.disabled });
  4005. i = af;
  4006. }
  4007. if (i) {x.selectallrows();} else {x.unselectallrows();}
  4008. x._checkboxcolumnupdating = false;
  4009. };
  4010. }
  4011. });
  4012. if (h > 0) {this.columnsheader.width(2 + h);} else {this.columnsheader.width(h);}
  4013. o[0].appendChild(f);
  4014. this.columnsrow = o;
  4015. x.columnsheader.append(o);
  4016. if (this.showfilterrow && this._updatefilterrow) {
  4017. if (!this.columngroups) {o.height(this.columnsheight);} else {o.height(this.columngroupslevel * this.columnsheight);}
  4018. if (!this.filterrow) {
  4019. var F = b("<div style='position: relative !important; '></div>");
  4020. F[0].id = "filterrow." + this.element.id;
  4021. F.height(this.filterrowheight);
  4022. this.filterrow = F;
  4023. }
  4024. this.filterrow.width(2 + h);
  4025. this.columnsheader.append(this.filterrow);
  4026. this._updatefilterrow();
  4027. }
  4028. if (this.showeverpresentrow && this.everpresentrowposition !== "bottom") {
  4029. if (!this.columngroups) {o.height(this.columnsheight);} else {o.height(this.columngroupslevel * this.columnsheight);}
  4030. if (!this.addnewrowtop) {
  4031. var m = b("<div style='position: relative !important; z-index:" + this.headerZIndex + ";'></div>");
  4032. m[0].id = "addnewrowtop." + this.element.id;
  4033. m.height(this.everpresentrowheight);
  4034. this.addnewrowtop = m;
  4035. }
  4036. this.addnewrowtop.width(2 + h);
  4037. if (this.everpresentrowposition == "topAboveFilterRow") {if (this.filterrow) {this.addnewrowtop.insertBefore(this.filterrow);} else {this.columnsheader.append(this.addnewrowtop);}} else {this.columnsheader.append(this.addnewrowtop);}
  4038. this._updateaddnewrow();
  4039. } else {
  4040. if (this.showeverpresentrow && this.everpresentrowposition === "bottom") {
  4041. if (!this.addnewrowbottom) {
  4042. var e = b("<div style='position: relative !important; z-index:" + this.headerZIndex + ";'></div>");
  4043. e[0].id = "addnewrowbottom." + this.element.id;
  4044. e.height(this.everpresentrowheight);
  4045. this.addnewrowbottom = e;
  4046. }
  4047. this.addnewrowbottom.width(2 + h);
  4048. this.addnewrow.append(this.addnewrowbottom);
  4049. this._updateaddnewrow();
  4050. }
  4051. }
  4052. if (h == 0) {o[0].style.visibility = "hidden";} else {o[0].style.visibility = "inherit";}
  4053. o.width(h);
  4054. if (this._handlecolumnsdragdrop) {this._handlecolumnsdragdrop();}
  4055. if (this._handlecolumnsreorder) {this._handlecolumnsreorder();}
  4056. if (this._rendersortcolumn) {this._rendersortcolumn();}
  4057. if (this._renderfiltercolumn) {this._renderfiltercolumn();}
  4058. if (this._handlecolumnsresize) {this._handlecolumnsresize();}
  4059. if (this.columngroups) {this._rendercolumngroups();}
  4060. if (this._updatecheckboxselection) {this._updatecheckboxselection();}
  4061. },
  4062. _rendercolumngroups: function () {
  4063. if (!this.columngroups) {return;}
  4064. var p = 0;
  4065. for (var m = 0; m < this.columns.records.length; m++) {if (this.columns.records[m].pinned) {p++;}}
  4066. var u = this.headerZIndex - p + this.columns.records.length;
  4067. var v = this.that;
  4068. var h = v.toTP("jqx-grid-column-header") + " " + v.toTP("jqx-grid-columngroup-header") + " " + v.toTP("jqx-widget-header");
  4069. if (v.rtl) {h += " " + v.toTP("jqx-grid-columngroup-header-rtl");}
  4070. var f = this.columnsheader.find("#columntable" + this.element.id);
  4071. f.find("jqx-grid-columngroup-header").remove();
  4072. for (var k = 0; k < this.columngroupslevel - 1; k++) {
  4073. for (var m = 0; m < this.columngroups.length; m++) {
  4074. var r = this.columngroups[m];
  4075. var d = r.level;
  4076. if (d !== k) {continue;}
  4077. var q = d * this.columnsheight;
  4078. var e = 99999;
  4079. if (r.groups) {
  4080. var t = function (y) {
  4081. var x = 0;
  4082. for (var w = 0; w < y.groups.length; w++) {
  4083. var i = y.groups[w];
  4084. if (!i.groups) {
  4085. if (!i.hidden) {
  4086. x += i.width;
  4087. e = Math.min(parseFloat(i.element.style.left), e);
  4088. }
  4089. } else {x += t(i);}
  4090. }
  4091. return x;
  4092. };
  4093. r.width = t(r);
  4094. r.left = e;
  4095. var s = this.columnsheight;
  4096. var n = u--;
  4097. var g = b('<div role="columnheader" style="z-index: ' + n + ';position: absolute;" class="' + h + '"></div>');
  4098. var l = b(this._rendercolumnheader(r.text, r.align, this.columnsheight, this));
  4099. if (r.renderer) {
  4100. var l = b("<div style='height: 100%; width: 100%;'></div>");
  4101. var o = r.renderer(r.text, r.align, s);
  4102. l.html(o);
  4103. }
  4104. g.append(l);
  4105. g[0].style.left = e + "px";
  4106. if (e === 0) {g[0].style.borderLeftColor = "transparent";}
  4107. if (!this.showcolumnheaderlines) {
  4108. g[0].style.borderRightColor = "transparent";
  4109. g[0].style.borderBottomColor = "transparent";
  4110. g[0].style.boxShadow = "none";
  4111. }
  4112. g[0].style.top = q + "px";
  4113. g[0].style.height = s + "px";
  4114. g[0].style.width = -1 + r.width + "px";
  4115. f.append(g);
  4116. r.element = g;
  4117. if (r.rendered) {r.rendered(l, r.align, s);}
  4118. }
  4119. }
  4120. }
  4121. },
  4122. _resizecolumngroups: function () {
  4123. if (!this.columngroups) {return;}
  4124. for (var e = 0; e < this.columngroups.length; e++) {
  4125. var k = this.columngroups[e];
  4126. var l = k.level;
  4127. var j = l * this.columnsheight;
  4128. var h = 99999;
  4129. if (k.groups) {
  4130. var g = function (o) {
  4131. var n = 0;
  4132. for (var m = 0; m < o.groups.length; m++) {
  4133. var i = o.groups[m];
  4134. if (!i.groups) {
  4135. if (!i.hidden) {
  4136. n += i.width;
  4137. h = Math.min(parseFloat(i.element.style.left), h);
  4138. }
  4139. } else {n += g(i);}
  4140. }
  4141. return n;
  4142. };
  4143. k.width = g(k);
  4144. k.left = h;
  4145. var d = this.columnsheight;
  4146. var f = k.element;
  4147. f[0].style.left = h + "px";
  4148. f[0].style.top = j + "px";
  4149. f[0].style.height = d + "px";
  4150. f[0].style.width = -1 + k.width + "px";
  4151. }
  4152. }
  4153. },
  4154. _handlecolumnsmenu: function (p, g, h, k, m) {
  4155. p.dragmousedown = null;
  4156. k[0].id = p.dataview.generatekey();
  4157. g.append(k);
  4158. h[0].columnsmenu = k[0];
  4159. m.element = h[0];
  4160. var l = this.columnsmenuwidth + 1;
  4161. var o = function () {
  4162. if (!m.menu) {return false;}
  4163. if (!p.resizing) {
  4164. if (m._menuvisible && p._hasOpenedMenu) {return false;}
  4165. m._animating = true;
  4166. if (p.menuitemsarray && p.menuitemsarray.length > 0) {
  4167. if (!p.enableanimations) {
  4168. k.css("display", "block");
  4169. var q = !p.rtl ? -48 : 16;
  4170. m.iconscontainer.css("margin-left", q + "px");
  4171. m._animating = false;
  4172. m._menuvisible = true;
  4173. } else {
  4174. k.css("display", "block");
  4175. k.stop();
  4176. m.iconscontainer.stop();
  4177. if (!p.rtl) {
  4178. k.css("margin-left", "0px");
  4179. k.animate({ "margin-left": -l }, "fast", function () {
  4180. k.css("display", "block");
  4181. m._animating = false;
  4182. m._menuvisible = true;
  4183. });
  4184. } else {
  4185. k.css("margin-left", -l);
  4186. k.animate({ "margin-left": "0px" }, "fast", function () {
  4187. k.css("display", "block");
  4188. m._animating = false;
  4189. m._menuvisible = true;
  4190. });
  4191. }
  4192. var q = !p.rtl ? -(32 + l) : l;
  4193. m.iconscontainer.animate({ "margin-left": q }, "fast");
  4194. }
  4195. }
  4196. }
  4197. };
  4198. var f = "mouseenter";
  4199. if (p.isTouchDevice()) {f = "touchstart";}
  4200. p.addHandler(h, f, function (r) {
  4201. var q = parseInt(r.pageX);
  4202. var t = p.columnsresize && m.resizable ? 3 : 0;
  4203. var v = parseInt(h.coord().left);
  4204. if (p.hasTransform) {v = b.jqx.utilities.getOffset(h).left;}
  4205. var u = m.width;
  4206. if (p.rtl) {u = 0;}
  4207. if (t != 0) {if (q >= v + u - t) {if (q <= v + u + t) {return false;}}}
  4208. var s = p.vScrollInstance.isScrolling();
  4209. if (m.menu && p.autoshowcolumnsmenubutton && !s && !p.disabled) {o();}
  4210. });
  4211. if (!p.autoshowcolumnsmenubutton) {
  4212. k.css("display", "block");
  4213. var e = !p.rtl ? -48 : 16;
  4214. m.iconscontainer.css("margin-left", e + "px");
  4215. if (!p.rtl) {k.css({ "margin-left": -l });} else {k.css({ "margin-left": "0px" });}
  4216. }
  4217. p.addHandler(h, "mouseleave", function (q) {
  4218. if (p.menuitemsarray && p.menuitemsarray.length > 0 && m.menu) {
  4219. var s = b.data(document.body, "contextmenu" + p.element.id);
  4220. if (s != undefined && k[0].id == s.columnsmenu.id) {return;}
  4221. if (p.autoshowcolumnsmenubutton) {
  4222. if (!p.enableanimations) {
  4223. k.css("display", "none");
  4224. var r = !p.rtl ? -32 : 0;
  4225. m.iconscontainer.css("margin-left", r + "px");
  4226. m._menuvisible = false;
  4227. } else {
  4228. if (!p.rtl) {k.css("margin-left", -l);} else {k.css("margin-left", "0px");}
  4229. k.stop();
  4230. m.iconscontainer.stop();
  4231. if (!p.rtl) {
  4232. k.animate({ "margin-left": 0 }, "fast", function () {
  4233. k.css("display", "none");
  4234. m._menuvisible = false;
  4235. });
  4236. } else {
  4237. k.animate({ "margin-left": -l }, "fast", function () {
  4238. k.css("display", "none");
  4239. m._menuvisible = false;
  4240. });
  4241. }
  4242. var r = !p.rtl ? -32 : 0;
  4243. m.iconscontainer.animate({ "margin-left": r }, "fast");
  4244. }
  4245. }
  4246. }
  4247. });
  4248. var j = true;
  4249. var d = "";
  4250. var i = b(m.filtericon);
  4251. p.addHandler(k, "mousedown", function (q) {
  4252. if (!p.gridmenu) {p._initmenu();}
  4253. j = !b.data(p.gridmenu[0], "contextMenuOpened" + p.gridmenu[0].id);
  4254. d = b.data(document.body, "contextmenu" + p.element.id);
  4255. if (d != null) {d = d.column.datafield;}
  4256. });
  4257. p.addHandler(i, "mousedown", function (q) {
  4258. if (!p.gridmenu) {p._initmenu();}
  4259. j = !b.data(p.gridmenu[0], "contextMenuOpened" + p.gridmenu[0].id);
  4260. d = b.data(document.body, "contextmenu" + p.element.id);
  4261. if (d != null) {d = d.column.datafield;}
  4262. });
  4263. var n = function () {
  4264. if (!m.menu) {return false;}
  4265. if (!p.gridmenu) {p._initmenu();}
  4266. if (p.disabled) {return false;}
  4267. for (var H = 0; H < p.columns.records.length; H++) {if (p.columns.records[H].datafield != m.datafield) {p.columns.records[H]._menuvisible = false;}}
  4268. var w = k.coord(true);
  4269. var B = k.height();
  4270. if (!j) {
  4271. j = true;
  4272. if (d == m.datafield) {
  4273. p._closemenu();
  4274. return false;
  4275. }
  4276. }
  4277. var r = p.host.coord(true);
  4278. if (p.hasTransform) {
  4279. r = b.jqx.utilities.getOffset(p.host);
  4280. w = b.jqx.utilities.getOffset(k);
  4281. }
  4282. if (r.left + p.host.width() > parseInt(w.left) + p.gridmenu.width()) {p.gridmenu.jqxMenu("open", w.left, w.top + B);} else {p.gridmenu.jqxMenu("open", k.width() + w.left - p.gridmenu.width(), w.top + B);}
  4283. if (p.gridmenu.width() < 100) {p._arrangemenu();}
  4284. if (p.adaptive && p.element.offsetWidth < p.adaptivewidth) {
  4285. p.gridmenu.jqxMenu("close");
  4286. p.gridmenu.jqxMenu("open", r.left, w.top + B);
  4287. var D = 0;
  4288. for (var H = 0; H < p.columns.records.length; H++) {
  4289. var v = p.columns.records[H];
  4290. if (v.hidden || v.adaptivehidden || v.columntype === "adaptive") {continue;}
  4291. D += v.adaptivewidth;
  4292. }
  4293. p.gridmenu.width(D);
  4294. p.gridmenu.height(p.content.height());
  4295. }
  4296. if (!p.filterable || (p.filterable && p.showfilterrow)) {
  4297. setTimeout(function () {
  4298. p.gridmenu.focus();
  4299. var I = p.gridmenu.find(".jqx-item");
  4300. for (var J = 0; J < I.length; J++) {if (I[J].active) {I[J].active = false;}}
  4301. var K = I[0];
  4302. if (I[0].className.indexOf("disabled") >= 0) {K = I[1];}
  4303. b(I).removeClass("jqx-fill-state-focus");
  4304. b(K).addClass("jqx-fill-state-focus");
  4305. K.active = true;
  4306. }, 225);
  4307. }
  4308. p._hasOpenedMenu = true;
  4309. var z = p._getmenuitembyindex(0);
  4310. var x = p._getmenuitembyindex(1);
  4311. var q = p._getmenuitembyindex(2);
  4312. var y = p._getmenuitembyindex(3);
  4313. var t = p._getmenuitembyindex(4);
  4314. var G = p._getmenuitembyindex(5);
  4315. if (z != null && x != null && q != null) {
  4316. var u = m.sortable && p.sortable;
  4317. p.gridmenu.jqxMenu("disable", z.id, !u);
  4318. p.gridmenu.jqxMenu("disable", x.id, !u);
  4319. p.gridmenu.jqxMenu("disable", q.id, !u);
  4320. if (m.displayfield != undefined) {
  4321. if (p.sortcolumn == m.displayfield) {
  4322. var E = p.getsortinformation();
  4323. if (u) {if (E.sortdirection.ascending) {p.gridmenu.jqxMenu("disable", z.id, true);} else {p.gridmenu.jqxMenu("disable", x.id, true);}}
  4324. } else {p.gridmenu.jqxMenu("disable", q.id, true);}
  4325. }
  4326. }
  4327. if (y != null && t != null) {
  4328. if (!p.groupable || !m.groupable) {
  4329. p.gridmenu.jqxMenu("disable", t.id, true);
  4330. p.gridmenu.jqxMenu("disable", y.id, true);
  4331. } else {
  4332. if (p.groups && p.groups.indexOf(m.datafield) != -1) {
  4333. p.gridmenu.jqxMenu("disable", y.id, true);
  4334. p.gridmenu.jqxMenu("disable", t.id, false);
  4335. } else {
  4336. p.gridmenu.jqxMenu("disable", y.id, false);
  4337. p.gridmenu.jqxMenu("disable", t.id, true);
  4338. }
  4339. }
  4340. }
  4341. if (G != null) {
  4342. p.menuOwner = m;
  4343. p._updatefilterpanel(p, G, m);
  4344. var s = 0;
  4345. if (p.sortable && p._togglesort && p.showsortmenuitems) {s += 3;}
  4346. if (p.groupable && p.addgroup && p.showgroupmenuitems) {s += 2;}
  4347. var C = s * 33 + 6;
  4348. var F = p._measureMenuElement();
  4349. var C = s * F + 14;
  4350. if (b.jqx.browser.msie && b.jqx.browser.version < 8) {
  4351. C += 20;
  4352. b(G).height(194);
  4353. }
  4354. if (p.isTouchDevice()) {C += 10;}
  4355. if (p.filterable && p.showfiltermenuitems) {
  4356. if (!m.filterable) {
  4357. p.gridmenu.height(C);
  4358. b(G).css("display", "none");
  4359. } else {
  4360. p.gridmenu.height(C + 194);
  4361. b(G).css("display", "block");
  4362. }
  4363. }
  4364. }
  4365. if (p.columnmenuopening) {
  4366. var A = p.columnmenuopening(p.gridmenu, m.displayfield, p.gridmenu.height());
  4367. if (false === A) {setTimeout(function () {p._closemenu();});}
  4368. }
  4369. b.data(document.body, "contextmenu" + p.element.id, { column: m, columnsmenu: k[0] });
  4370. };
  4371. p.addHandler(i, "click", function (q) {
  4372. if (!m.menu) {return false;}
  4373. if (!p.showfilterrow) {
  4374. if (k[0].style.display != "block") {h.trigger("mouseenter");}
  4375. setTimeout(function () {
  4376. if (k[0].style.display != "block") {h.trigger("mouseenter");}
  4377. n();
  4378. }, 200);
  4379. }
  4380. return false;
  4381. });
  4382. p.addHandler(k, "click", function (q) {
  4383. if (!m.menu) {return false;}
  4384. n();
  4385. return false;
  4386. });
  4387. if (p.isTouchDevice()) {
  4388. p.addHandler(k, b.jqx.mobile.getTouchEventName("touchstart"), function (q) {
  4389. if (!m.menu) {return false;}
  4390. if (!p._hasOpenedMenu) {n();} else {p._closemenu();}
  4391. return false;
  4392. });
  4393. }
  4394. },
  4395. _removecolumnhandlers: function (h) {
  4396. var e = this.that;
  4397. var f = b(h.element);
  4398. if (f.length > 0) {
  4399. e.removeHandler(f, "mouseenter");
  4400. e.removeHandler(f, "mouseleave");
  4401. var g = b(h.filtericon);
  4402. e.removeHandler(g, "mousedown");
  4403. e.removeHandler(g, "click");
  4404. e.removeHandler(f, "click");
  4405. e.removeHandler(f, "mousemove");
  4406. if (e.columnsreorder) {
  4407. e.removeHandler(f, "mousedown.drag");
  4408. e.removeHandler(f, "mousemove.drag");
  4409. }
  4410. e.removeHandler(f, "dragstart");
  4411. if (f[0].columnsmenu) {
  4412. var d = b(f[0].columnsmenu);
  4413. e.removeHandler(d, "click");
  4414. e.removeHandler(d, "mousedown");
  4415. e.removeHandler(d, b.jqx.mobile.getTouchEventName("touchstart"));
  4416. }
  4417. }
  4418. },
  4419. _rendercolumnheader: function (h, i, e, d) {
  4420. var g = "8px";
  4421. if (d.columngroups) {
  4422. g = (e / 2 - this._columnheight / 2);
  4423. if (g < 0) {g = 6;}
  4424. g += "px";
  4425. } else {
  4426. if (this.columnsheight != 32) {
  4427. g = (this.columnsheight / 2 - this._columnheight / 2);
  4428. if (g < 0) {g = 6;}
  4429. g += "px";
  4430. }
  4431. }
  4432. if (this.enableellipsis) {if (i == "left") {return '<div style="padding-bottom: 2px; overflow: hidden; text-overflow: ellipsis; text-align: ' + i + "; margin-left: 4px; margin-right: 2px; line-height: " + e + 'px;"><span style="text-overflow: ellipsis; cursor: default;">' + h + "</span></div>";} else {return '<div style="padding-bottom: 2px; overflow: hidden; text-overflow: ellipsis; text-align: ' + i + "; margin-left: 2px; margin-right: 4px; line-height: " + e + 'px;"><span style="text-overflow: ellipsis; cursor: default;">' + h + "</span></div>";}}
  4433. if (i == "center" || i == "middle") {return '<div style="padding-bottom: 2px; text-align: center; line-height: ' + e + 'px;"><a href="#">' + h + "</a></div>";}
  4434. var f = '<a style="line-height: ' + e + "px; float: " + i + ';" href="#">' + h + "</a>";
  4435. return f;
  4436. },
  4437. _renderrows: function (m, p, t) {
  4438. var o = this.that;
  4439. if ((this.pageable || this.groupable) && (this.autoheight || this.autorowheight)) {if (this.table != null && this.table[0].rows != null && this.table[0].rows.length < this.dataview.rows.length) {o.prerenderrequired = true;}}
  4440. if (!this.pageable && (this.autoheight || this.autorowheight) && (this.virtualmode || this.unboundmode)) {
  4441. var f = this.source.totalrecords;
  4442. if (!isNaN(f)) {if (this.table != null && this.table[0].rows != null && this.table[0].rows.length != f) {o.prerenderrequired = true;}}
  4443. }
  4444. if ((this.autoheight || this.autorowheight) && !o.prerenderrequired) {
  4445. if (this.table && this.table[0].rows) {
  4446. if (this.table[0].rows.length < this.dataview.records.length) {if (this.pageable && this.table[0].rows.length < this.dataview.pagesize) {o.prerenderrequired = true;} else {if (!this.pageable) {o.prerenderrequired = true;}}}
  4447. if (this.table[0].rows.length < this.dataview.cachedrecords.length) {if (this.pageable && this.table[0].rows.length < this.dataview.pagesize) {o.prerenderrequired = true;} else {if (!this.pageable) {o.prerenderrequired = true;}}}
  4448. }
  4449. }
  4450. o._prerenderrows(m);
  4451. if (o._requiresupdate) {
  4452. o._requiresupdate = false;
  4453. o._updatepageviews();
  4454. }
  4455. var l = function () {
  4456. if (o._loading) {return;}
  4457. if (o.WinJS) {MSApp.execUnsafeLocalFunction(function () {o._rendervisualrows();});} else {o._rendervisualrows();}
  4458. if (o.virtualmode && o.showaggregates && o._updateaggregates) {o.refreshaggregates();}
  4459. };
  4460. var k = b.jqx.browser.msie && b.jqx.browser.version < 10;
  4461. if (this.virtualmode) {
  4462. var e = function () {
  4463. if (o.rendergridrows) {
  4464. var y = o._startboundindex;
  4465. if (y == undefined) {y = 0;}
  4466. var w = y + 1 + o.dataview.pagesize;
  4467. if (y != null && w != null) {
  4468. var x = o.source._source ? true : false;
  4469. var z = !x ? o.source.recordstartindex : o.source._source.recordstartindex;
  4470. if (z != y || p == true) {
  4471. if (!x) {
  4472. o.source.recordstartindex = y;
  4473. o.source.recordendindex = w;
  4474. } else {
  4475. if (w >= o.source._source.totalrecords) {
  4476. w = o.source._source.totalrecords;
  4477. y = w - o.dataview.pagesize - 1;
  4478. if (y < 0) {y = 0;}
  4479. if (o.source._source.recordendindex == w && o.source._source.recordstartindex == y) {return;}
  4480. }
  4481. o.source._source.recordstartindex = y;
  4482. o.source._source.recordendindex = w;
  4483. }
  4484. o.updatebounddata("cells");
  4485. }
  4486. }
  4487. }
  4488. };
  4489. if (this.loadondemand) {
  4490. l();
  4491. e();
  4492. this.loadondemand = false;
  4493. }
  4494. var d = this._browser == undefined ? this._isIE10() : this._browser;
  4495. if (this.editable && this.editcell && !this.vScrollInstance.isScrolling() && !this.hScrollInstance.isScrolling()) {l();} else {
  4496. if (this.autoheight) {l();} else {
  4497. if (d || k || (navigator && navigator.userAgent.indexOf("Safari") != -1)) {
  4498. if (this._scrolltimer != null) {clearTimeout(this._scrolltimer);}
  4499. this._scrolltimer = setTimeout(function () {l();}, 5);
  4500. } else {l();}
  4501. }
  4502. }
  4503. } else {
  4504. if (this.scrollmode == "deferred" && (this.hScrollInstance.isScrolling() || this.vScrollInstance.isScrolling())) {
  4505. if (this._scrolltimer != null) {clearInterval(this._scrolltimer);}
  4506. var g = this._getfirstvisualrow();
  4507. if (g != null) {
  4508. var r = function (B) {
  4509. if (g == null) {return "";}
  4510. var A = "<table>";
  4511. var y = o.deferreddatafields;
  4512. if (y == null) {
  4513. if (o.columns.records.length > 0) {
  4514. y = new Array();
  4515. y.push(o.columns.records[0].displayfield);
  4516. }
  4517. }
  4518. for (var x = 0; x < y.length; x++) {
  4519. var C = y[x];
  4520. var z = o._getcolumnbydatafield(C);
  4521. if (z) {
  4522. var w = o._getcellvalue(z, g);
  4523. if (z.cellsformat != "") {if (b.jqx.dataFormat) {if (b.jqx.dataFormat.isDate(w)) {w = b.jqx.dataFormat.formatdate(w, z.cellsformat, o.gridlocalization);} else {if (b.jqx.dataFormat.isNumber(w)) {w = b.jqx.dataFormat.formatnumber(w, z.cellsformat, o.gridlocalization);}}}}
  4524. A += "<tr><td>" + w + "</td></tr>";
  4525. }
  4526. }
  4527. A += "</table>";
  4528. return A;
  4529. };
  4530. var i = this.scrollfeedback ? this.scrollfeedback(g.bounddata) : r(g.bounddata);
  4531. if (i != this._scrollelementcontent) {
  4532. this._scrollelement[0].innerHTML = i;
  4533. this._scrollelementcontent = i;
  4534. }
  4535. }
  4536. this._scrollelement.css("visibility", "visible");
  4537. this._scrollelementoverlay.css("visibility", "visible");
  4538. this._scrollelement.css("margin-top", -this._scrollelement.height() / 2);
  4539. this._scrolltimer = setInterval(function () {
  4540. if (!o.hScrollInstance.isScrolling() && !o.vScrollInstance.isScrolling()) {
  4541. l();
  4542. o._scrollelement.css("visibility", "hidden");
  4543. o._scrollelementoverlay.css("visibility", "hidden");
  4544. clearInterval(o._scrolltimer);
  4545. if (g) {o.ensurerowvisible(g.visibleindex);}
  4546. }
  4547. }, 100);
  4548. return;
  4549. }
  4550. if (navigator && navigator.userAgent.indexOf("Chrome") == -1 && navigator.userAgent.indexOf("Safari") != -1) {this._updatedelay = 1;}
  4551. if (this.touchDevice != undefined && this.touchDevice == true) {this._updatedelay = 5;}
  4552. var d = this._browser == undefined ? this._isIE10() : this._browser;
  4553. if (d || k) {this._updatedelay = 5;}
  4554. if ((d) && this.hScrollInstance.isScrolling()) {
  4555. l();
  4556. return;
  4557. }
  4558. if (b.jqx.browser.mozilla && this._updatedelay == 0 && (this.vScrollInstance.isScrolling() || this.hScrollInstance.isScrolling())) {this._updatedelay = 0;}
  4559. var h = this.isTouchDevice();
  4560. if (h) {this._updatedelay = 0;}
  4561. if (this.updatedelay != null) {this._updatedelay = this.updatedelay;}
  4562. if (this._updatedelay == 0) {l();} else {
  4563. var j = this._jqxgridrendertimer;
  4564. if (j != null) {clearTimeout(j);}
  4565. if (this.vScrollInstance.isScrolling() || this.hScrollInstance.isScrolling()) {
  4566. if (this._updatedelay) {j = setTimeout(function () {l();}, this._updatedelay);} else {
  4567. j = null;
  4568. l();
  4569. }
  4570. this._jqxgridrendertimer = j;
  4571. } else {
  4572. this._jqxgridrendertimer = j;
  4573. l();
  4574. }
  4575. }
  4576. }
  4577. if (o.autorowheight && !o.autoheight) {
  4578. if (this._pageviews.length > 0) {
  4579. var n = this._gettableheight();
  4580. var q = this._pageviews[0].height;
  4581. if (q > n) {
  4582. if (this.pageable && this.gotopage) {
  4583. q = this._pageviews[0].height;
  4584. if (q < 0) {q = this._pageviews[0].height;}
  4585. }
  4586. if (this.vScrollBar.css("visibility") != "visible") {this.vScrollBar.css("visibility", "visible");}
  4587. if (q <= n || this.autoheight) {this.vScrollBar.css("visibility", "hidden");}
  4588. if (q - n > 0) {
  4589. if (this.scrollmode != "deferred") {
  4590. var s = q - n;
  4591. var u = this.vScrollInstance.max;
  4592. this.vScrollBar.jqxScrollBar({ max: s });
  4593. if (Math.round(s) != Math.round(u)) {
  4594. var v = this.vScrollBar.jqxScrollBar("value");
  4595. if (v > s) {this.vScrollBar.jqxScrollBar({ value: 0 });}
  4596. }
  4597. }
  4598. } else {this.vScrollBar.jqxScrollBar({ value: 0, max: q });}
  4599. } else {
  4600. if (!this._loading) {this.vScrollBar.css("visibility", "hidden");}
  4601. this.vScrollBar.jqxScrollBar({ value: 0 });
  4602. }
  4603. this._arrange();
  4604. if (this.virtualsizeinfo) {this.virtualsizeinfo.virtualheight = q;}
  4605. }
  4606. }
  4607. },
  4608. scrolling: function () {
  4609. var e = this.vScrollInstance.isScrolling();
  4610. var d = this.hScrollInstance.isScrolling();
  4611. return { vertical: e, horizontal: d };
  4612. },
  4613. _renderhorizontalscroll: function () {
  4614. var t = this.hScrollInstance;
  4615. var u = t.value;
  4616. if (this.hScrollBar.css("visibility") === "hidden") {
  4617. t.value = 0;
  4618. u = 0;
  4619. }
  4620. var k = parseInt(u);
  4621. if (this.table == null) {return;}
  4622. var q = this.table[0].rows.length;
  4623. var p = this.columnsrow;
  4624. var r = this.groupable && this.groups.length > 0 ? this.groups.length : 0;
  4625. var l = this.columns.records.length - r;
  4626. var f = this.columns.records;
  4627. var n = this.dataview.rows.length == 0;
  4628. if (this.rtl) {if (this.hScrollBar.css("visibility") != "hidden") {k = t.max - k;}}
  4629. if (n && !this._haspinned) {
  4630. for (var w = 0; w < q; w++) {
  4631. var s = this.table[0].rows[w];
  4632. for (var v = 0; v < r + l; v++) {
  4633. var d = s.cells[v];
  4634. if (d != undefined) {
  4635. var g = f[v];
  4636. if (g.pinned) {
  4637. d.style.marginLeft = k + "px";
  4638. if (w == 0) {
  4639. var e = p[0].cells[v];
  4640. e.style.marginLeft = k + "px";
  4641. }
  4642. }
  4643. }
  4644. }
  4645. }
  4646. this.table[0].style.marginLeft = -k + "px";
  4647. p[0].style.marginLeft = -k + "px";
  4648. } else {
  4649. if (this._haspinned || this._haspinned == undefined) {
  4650. for (var w = 0; w < q; w++) {
  4651. var s = this.table[0].rows[w];
  4652. for (var v = 0; v < r + l; v++) {
  4653. var d = s.cells[v];
  4654. if (d != undefined) {
  4655. var g = f[v];
  4656. if (g.pinned) {
  4657. if (k == 0 && d.style.marginLeft == "") {continue;}
  4658. var h = null;
  4659. var x = null;
  4660. var o = null;
  4661. if (this.showeverpresentrow && this.addnewrowtop) {if (this.addnewrowtop[0].cells) {o = this.addnewrowtop[0].cells[v];}}
  4662. if (this.showfilterrow && this.filterrow) {if (this.filterrow[0].cells) {x = this.filterrow[0].cells[v];}}
  4663. if (this.showaggregates) {if (this.statusbar[0].cells) {h = this.statusbar[0].cells[v];}}
  4664. if (!this.rtl) {
  4665. d.style.marginLeft = k + "px";
  4666. if (w == 0) {
  4667. var e = p[0].cells[v];
  4668. e.style.marginLeft = k + "px";
  4669. if (h) {h.style.marginLeft = k + "px";}
  4670. if (x) {x.style.marginLeft = k + "px";}
  4671. if (o) {o.style.marginLeft = k + "px";}
  4672. }
  4673. } else {
  4674. d.style.marginLeft = -parseInt(u) + "px";
  4675. if (w == 0) {
  4676. var e = p[0].cells[v];
  4677. e.style.marginLeft = -parseInt(u) + "px";
  4678. if (h) {h.style.marginLeft = -parseInt(u) + "px";}
  4679. if (x) {x.style.marginLeft = -parseInt(u) + "px";}
  4680. if (o) {o.style.marginLeft = -parseInt(u) + "px";}
  4681. }
  4682. }
  4683. }
  4684. }
  4685. }
  4686. }
  4687. this.table[0].style.marginLeft = -k + "px";
  4688. p[0].style.marginLeft = -k + "px";
  4689. } else {
  4690. if (this._haspinned == false) {
  4691. this.table[0].style.marginLeft = -k + "px";
  4692. p[0].style.marginLeft = -k + "px";
  4693. }
  4694. }
  4695. }
  4696. if (this.showaggregates) {
  4697. if (this.statusbar[0].cells) {
  4698. var m = 0;
  4699. if (this.rtl) {if (this.vScrollBar.css("visibility") != "hidden") {if (this.hScrollBar.css("visibility") != "hidden") {m = 2 + parseInt(this.hScrollBar.css("left"));}}}
  4700. this.statusbar[0].style.marginLeft = -k + m + "px";
  4701. }
  4702. }
  4703. if (this.showfilterrow && this.filterrow) {if (this.filterrow[0].cells) {this.filterrow[0].style.marginLeft = -k + "px";}}
  4704. if (this.showeverpresentrow && this.addnewrowtop) {if (this.addnewrowtop[0].cells) {this.addnewrowtop[0].style.marginLeft = -k + "px";}}
  4705. },
  4706. _updaterowdetailsvisibility: function () {if (this.rowdetails) {for (var d = 0; d < this._rowdetailselementscache.length; d++) {b(this._rowdetailselementscache[d]).css("display", "none");}}},
  4707. _getvisualcolumnsindexes: function (e, n, i, m, d, l) {
  4708. if (this.rowdetails || this.rtl || this.editcell || (this.width && this.width.toString().indexOf("%") >= 0) || this.exporting) {return { start: 0, end: i + m };}
  4709. var f = 0;
  4710. var k = -1;
  4711. var g = i + m;
  4712. var o = false;
  4713. if (this.autorowheight) {return { start: 0, end: i + m };}
  4714. if (!d) {
  4715. for (var h = 0; h < i + m; h++) {
  4716. var p = h;
  4717. if (!o) {if (this.columns.records[h].pinned && l) {o = true;}}
  4718. if (!this.columns.records[h].hidden && !this.columns.records[h].adaptivehidden) {f += this.columns.records[h].width;}
  4719. if (f >= e && k == -1) {k = h;}
  4720. if (f > n + e) {
  4721. g = h;
  4722. break;
  4723. }
  4724. }
  4725. }
  4726. g++;
  4727. if (g > i + m) {g = i + m;}
  4728. if (k == -1 || o) {k = 0;}
  4729. return { start: k, end: g };
  4730. },
  4731. _getvirtualcolumnsindexes: function (e, m, i, l, d) {
  4732. if (this.rtl || this.editcell || this.exporting) {return { start: 0, end: i + l };}
  4733. var f = 0;
  4734. var k = -1;
  4735. var g = i + l;
  4736. if (this.autorowheight) {return { start: 0, end: i + l };}
  4737. if (!d) {
  4738. for (var h = 0; h < i + l; h++) {
  4739. var n = h;
  4740. if (!this.columns.records[h].hidden && !this.columns.records[h].adaptivehidden) {f += this.columns.records[h].width;}
  4741. if (f >= e && k == -1) {k = h;}
  4742. if (f > m + e) {
  4743. g = h;
  4744. break;
  4745. }
  4746. }
  4747. }
  4748. g++;
  4749. if (g > i + l) {g = i + l;}
  4750. if (k == -1) {k = 0;}
  4751. return { start: k, end: g };
  4752. },
  4753. _getfirstvisualrow: function () {
  4754. var e = this.vScrollInstance;
  4755. var g = e.value;
  4756. var f = parseInt(g);
  4757. if (this._pagescache.length == 0) {
  4758. this.dataview.updateview();
  4759. this._loadrows();
  4760. }
  4761. if (this.vScrollBar[0].style.visibility != "visible") {f = 0;}
  4762. if (!this.pageable) {
  4763. var d = this._findvisiblerow(f, this._pageviews);
  4764. if (d == -1) {return null;}
  4765. if (d != this.dataview.pagenum) {
  4766. this.dataview.pagenum = d;
  4767. this.dataview.updateview();
  4768. this._loadrows();
  4769. } else {if (!this._pagescache[this.dataview.pagenum]) {this._loadrows();}}
  4770. }
  4771. var h = this._findvisiblerow(f, this._pagescache[this.dataview.pagenum]);
  4772. var i = this._pagescache[this.dataview.pagenum];
  4773. if (i && i[0]) {return i[h];}
  4774. },
  4775. _rendervisualrows: function () {
  4776. if (!this.virtualsizeinfo) {return;}
  4777. var Y = this.vScrollInstance;
  4778. var p = this.hScrollInstance;
  4779. var j = Y.value;
  4780. var C = p.value;
  4781. var o = parseInt(j);
  4782. var l = parseInt(C);
  4783. var x = this._gettableheight();
  4784. var J = this._hostwidth != undefined ? this._hostwidth : this.host.width();
  4785. if (this.hScrollBar[0].style.visibility == "visible") {x += 29;}
  4786. if (this.scrollmode == "deferred" && this._newmax != 0) {if (o > this._newmax && this._newmax != null) {o = this._newmax;}}
  4787. var al = Y.isScrolling() || p.isScrolling() || this._keydown;
  4788. var D = this.groupable && this.groups.length > 0;
  4789. this.visiblerows = new Array();
  4790. this.hittestinfo = new Array();
  4791. if (this.editcell && this.editrow == undefined) {this._hidecelleditor(false);}
  4792. if (this.editrow != undefined) {this._hideeditors();}
  4793. if (this.virtualmode && !this.pageable) {this._pagescache = new Array();}
  4794. if (this._pagescache.length == 0) {
  4795. this.dataview.updateview();
  4796. this._loadrows();
  4797. }
  4798. if (this.vScrollBar[0].style.visibility == "hidden") {o = 0;}
  4799. if (!this.pageable) {
  4800. var L = this._findvisiblerow(o, this._pageviews);
  4801. if (L == -1) {
  4802. this._clearvisualrows();
  4803. this._renderemptyrow();
  4804. this._updaterowdetailsvisibility();
  4805. return;
  4806. }
  4807. if (L != this.dataview.pagenum) {
  4808. this.dataview.pagenum = L;
  4809. this.dataview.updateview();
  4810. this._loadrows();
  4811. } else {if (!this._pagescache[this.dataview.pagenum]) {this._loadrows();}}
  4812. }
  4813. var an = this.groupable && this.groups.length > 0 ? this.groups.length : 0;
  4814. if (!this.columns.records) {return;}
  4815. var r = this.columns.records.length - an;
  4816. var ad = this._findvisiblerow(o, this._pagescache[this.dataview.pagenum]);
  4817. var M = this._pagescache[this.dataview.pagenum];
  4818. var S = ad;
  4819. if (S < 0) {S = 0;}
  4820. var ag = 0;
  4821. var ac = 0;
  4822. var Q = 0;
  4823. var e = 0;
  4824. var U = this.virtualsizeinfo.visiblerecords;
  4825. var P = this.groupable ? this.groups.length : 0;
  4826. var B = this.toTP("jqx-grid-cell") + " " + this.toTP("jqx-item");
  4827. if (this.rtl) {B += " " + this.toTP("jqx-grid-cell-rtl");}
  4828. if ((this.autoheight || this.autorowheight) && this.pageable) {if (!this.groupable || (this.groupable && this.groups.length === 0)) {U = this.dataview.pagesize;}}
  4829. if (D) {B = " " + this.toTP("jqx-grid-group-cell");}
  4830. if (this.isTouchDevice()) {B += " " + this.toTP("jqx-touch");}
  4831. if (this.autorowheight) {B += " jqx-grid-cell-wrap";}
  4832. var O = this.rowsheight;
  4833. var G = S;
  4834. var am = this._rendercell;
  4835. var u = true;
  4836. var q = this._getvisualcolumnsindexes(l, J, an, r, D, true);
  4837. var d = q.start;
  4838. var ab = q.end;
  4839. var t = this._getvirtualcolumnsindexes(l, J, an, r, D);
  4840. var I = t.start;
  4841. var h = t.end;
  4842. var af = b.jqx.browser.msie && b.jqx.browser.version < 9;
  4843. if ((this.autoheight || this.pageable) && this.autorowheight) {if (this._pageviews[0]) {this._oldpageviewheight = this._pageviews[0].height;}}
  4844. if (this.autorowheight) {S = 0;}
  4845. if (S >= 0) {
  4846. this._updaterowdetailsvisibility();
  4847. this._startboundindex = M != null ? M[S].bounddata.boundindex : 0;
  4848. this._startvisibleindex = M != null ? M[S].bounddata.visibleindex : 0;
  4849. var A = this.table[0].rows;
  4850. if (this.columns.records.length > 10 && this.enablecolumnsvirtualization) {
  4851. var H = function (i) {
  4852. if (i.parentNode && i.parentNode.nodeName != "#document-fragment") {return true;}
  4853. return false;
  4854. };
  4855. for (var ah = 0; ah < A.length; ah++) {
  4856. var k = A[ah];
  4857. for (var V = 0; V < I; V++) {
  4858. var aj = V;
  4859. if (this.columns.records[aj].pinned) {continue;}
  4860. if (this.columns.records[aj].datafield == null) {continue;}
  4861. var ai = k.cells[aj];
  4862. if (H(ai)) {ai.parentNode.removeChild(ai);}
  4863. var R = this.columns.records[aj].element;
  4864. this.columns.records[aj]._rendered = false;
  4865. if (H(R)) {this.columnsrow[0].removeChild(R);}
  4866. if (this.filterrow) {if (H(this.filterrow[0].cells[aj]) && this.columns.records[aj].filterable) {this.filterrow[0].cells[aj].parentNode.removeChild(this.filterrow[0].cells[aj]);}}
  4867. }
  4868. for (var V = h; V < this.columns.records.length; V++) {
  4869. var aj = V;
  4870. if (this.columns.records[aj].pinned) {continue;}
  4871. if (this.columns.records[aj].datafield == null) {continue;}
  4872. var ai = k.cells[aj];
  4873. if (H(ai)) {ai.parentNode.removeChild(ai);}
  4874. var R = this.columns.records[aj].element;
  4875. this.columns.records[aj]._rendered = false;
  4876. if (H(R)) {this.columnsrow[0].removeChild(R);}
  4877. if (this.filterrow) {if (H(this.filterrow[0].cells[aj]) && this.columns.records[aj].filterable) {this.filterrow[0].cells[aj].parentNode.removeChild(this.filterrow[0].cells[aj]);}}
  4878. }
  4879. for (var V = I; V < h; V++) {
  4880. var aj = V;
  4881. var ai = k.cells[aj];
  4882. if (!H(ai)) {k.appendChild(ai);}
  4883. var R = this.columns.records[aj].element;
  4884. this.columns.records[aj]._rendered = true;
  4885. if (R.selectable) {
  4886. ai.removeAttribute("selected");
  4887. if (R.selected) {ai.setAttribute("selected", "");}
  4888. }
  4889. if (!H(R)) {this.columnsrow[0].appendChild(R);}
  4890. if (this.filterrow && !H(this.filterrow[0].cells[aj]) && this.columns.records[aj].filterable) {this.filterrow[0].firstChild.appendChild(this.filterrow[0].cells[aj]);}
  4891. }
  4892. }
  4893. }
  4894. for (var n = 0; n < U && ac < U; n++) {
  4895. var ae = M != undefined ? M[S + n] : null;
  4896. if (this.virtualmode && n >= this.source.totalrecords) {ae = null;}
  4897. if (ae == null) {
  4898. S = -n;
  4899. if (this._pagescache[this.dataview.pagenum + 1]) {
  4900. M = this._pagescache[this.dataview.pagenum + 1];
  4901. this.dataview.pagenum++;
  4902. } else {
  4903. var s = this._pageviews.length;
  4904. do {
  4905. if (this.dataview.pagenum < this._pageviews.length - 1) {
  4906. this.dataview.pagenum++;
  4907. M = undefined;
  4908. if (this._pageviews[this.dataview.pagenum].height > 0) {
  4909. this.dataview.updateview();
  4910. this._loadrows();
  4911. M = this._pagescache[this.dataview.pagenum];
  4912. }
  4913. } else {
  4914. M = undefined;
  4915. break;
  4916. }
  4917. } while (M == undefined && this.dataview.pagenum < s);
  4918. }
  4919. if (M != undefined) {ae = M[S + n];}
  4920. }
  4921. if (ae != null) {
  4922. if (ae.hidden) {continue;}
  4923. this._endboundindex = this._startboundindex + n;
  4924. this._endvisibleindex = this._startvisibleindex + n;
  4925. if (n == 0) {
  4926. var m = Math.abs(o - ae.top);
  4927. this.table[0].style.top = -m + "px";
  4928. e = -m;
  4929. }
  4930. var k = this.table[0].rows[ac];
  4931. if (!k) {continue;}
  4932. if (parseInt(k.style.height) != ae.height) {k.style.height = parseInt(ae.height) + "px";}
  4933. Q += ae.height;
  4934. var X = this.rowdetails && ae.rowdetails;
  4935. var w = !ae.rowdetailshidden;
  4936. if (X && w) {
  4937. k.style.height = parseInt(ae.height - ae.rowdetailsheight) + "px";
  4938. U++;
  4939. }
  4940. var K = this._isrowselected(u, ae);
  4941. for (var V = d; V < ab; V++) {
  4942. var aj = V;
  4943. this._rendervisualcell(am, B, K, X, w, D, P, k, ae, aj, ac, al);
  4944. }
  4945. if (ae.group != undefined && this._rendergroup) {this._rendergroup(P, k, ae, an, r, ac, J);}
  4946. if (this.autorowheight && (this.autoheight || this.pageable)) {
  4947. var O = this.rowsheight;
  4948. for (var V = d; V < ab; V++) {
  4949. if (this.editable && this.editcell && this.editcell.column == this.columns.records[V].datafield && this.editcell.row == this.getboundindex(ae)) {
  4950. if (this.editcell.editor) {
  4951. O = Math.max(O, this.editcell.editor.height());
  4952. continue;
  4953. }
  4954. }
  4955. if (k.cells[V].firstChild) {O = Math.max(O, 8 + parseInt(k.cells[V].firstChild.offsetHeight));}
  4956. }
  4957. k.style.height = parseInt(O) + "px";
  4958. this.heights[this._startboundindex + n] = O;
  4959. if (X && w) {O += ae.rowdetailsheight;}
  4960. ae.height = O;
  4961. }
  4962. this.visiblerows[this.visiblerows.length] = ae;
  4963. this.hittestinfo[this.hittestinfo.length] = { row: ae, visualrow: k, details: false };
  4964. if (X && w) {
  4965. ac++;
  4966. var k = this.table[0].rows[ac];
  4967. this._renderrowdetails(B, k, ae, an, r, ac);
  4968. this.visiblerows[this.visiblerows.length] = ae;
  4969. this.hittestinfo[this.hittestinfo.length] = { row: ae, visualrow: k, details: true };
  4970. }
  4971. if (!this.autorowheight) {if (Q + e >= x) {break;}}
  4972. } else {
  4973. var aa = true;
  4974. this._clearvisualrow(l, D, ac, an, r);
  4975. if (Q + ag + e <= x) {ag += O;}
  4976. }
  4977. ac++;
  4978. }
  4979. this._horizontalvalue = l;
  4980. if (ag > 0) {
  4981. if (this.vScrollBar[0].style.visibility == "visible") {
  4982. var ak = parseInt(this.table.css("top"));
  4983. var F = this._pageviews[this._pageviews.length - 1];
  4984. var v = Y.max;
  4985. var E = F.top + F.height - x;
  4986. if (this.hScrollBar.css("visibility") == "visible") {E += this.scrollbarsize + 20;}
  4987. if (v != E && !this.autorowheight) {
  4988. if (E >= 0) {
  4989. if (this.scrollmode != "deferred") {
  4990. Y.max = E;
  4991. Y.setPosition(Y.max);
  4992. } else {
  4993. if (this._newmax != E) {
  4994. this._newmax = E;
  4995. this._rendervisualrows();
  4996. }
  4997. }
  4998. }
  4999. }
  5000. }
  5001. }
  5002. }
  5003. if ((this.autoheight || this.pageable) && this.autorowheight) {
  5004. this._pagescache = new Array();
  5005. var W = 0;
  5006. var g = 0;
  5007. for (var ah = 0; ah < this.visiblerows.length; ah++) {
  5008. var z = this.visiblerows[ah];
  5009. z.top = W;
  5010. W += z.height;
  5011. g += z.height;
  5012. var X = this.rowdetails && z.rowdetails;
  5013. var w = !z.rowdetailshidden;
  5014. var k = this.table[0].rows[ah];
  5015. if (X && w) {ah++;}
  5016. for (var V = d; V < ab; V++) {
  5017. var Z = this.columns.records[V];
  5018. if (!Z.hidden && !Z.adaptivehidden) {
  5019. if (!Z.cellsrenderer) {
  5020. var N = k.cells[V];
  5021. var f = 0;
  5022. if (N.firstChild) {
  5023. var f = (z.height - parseInt(N.firstChild.offsetHeight) - 8) / 2;
  5024. if (X && w) {var f = (z.height - z.rowdetailsheight - b(N.firstChild).height() - 8) / 2;}
  5025. } else {var f = (z.height - parseInt(b(N).height()) - 8) / 2;}
  5026. if (f >= 0) {
  5027. f = parseInt(f) + 4;
  5028. if (N.firstChild) {
  5029. if (N.firstChild.className.indexOf("jqx-grid-groups-row") == -1) {
  5030. if (Z.columntype != "checkbox" && Z.columntype != "button") {
  5031. if (this.editable && this.editcell && this.editcell.column == Z.datafield && this.editcell.row == this.getboundindex(z)) {continue;}
  5032. N.firstChild.style.marginTop = f + "px";
  5033. }
  5034. }
  5035. }
  5036. }
  5037. }
  5038. }
  5039. }
  5040. }
  5041. if (this._pageviews[0]) {this._pageviews[0].height = g;}
  5042. this._arrange();
  5043. }
  5044. this._renderemptyrow();
  5045. if (this.toCompile && this.toCompile.length > 0) {
  5046. var T = this;
  5047. b.each(T.toCompile, function (y, ao) {
  5048. if (this.compiled) {return true;}
  5049. var i = this.cell;
  5050. if (!i) {return true;}
  5051. if (b.jqx.angularCompile) {b.jqx.angularCompile(i, "<div>" + this.value + "</div>");}
  5052. this.compiled = true;
  5053. });
  5054. }
  5055. },
  5056. _hideemptyrow: function () {
  5057. if (!this.showemptyrow) {return;}
  5058. if (!this.table) {return;}
  5059. if (!this.table[0].rows) {return;}
  5060. var f = this.table[0].rows[0];
  5061. if (!f) {return;}
  5062. var g = false;
  5063. for (var e = 0; e < f.cells.length; e++) {
  5064. var d = b(f.cells[e]);
  5065. if (d.css("display") != "none" && !g) {
  5066. if (d.width() == this.host.width() || d.text() == this.gridlocalization.emptydatastring) {
  5067. d[0].checkbox = null;
  5068. d[0].button = null;
  5069. g = true;
  5070. d[0].innerHTML = "";
  5071. }
  5072. }
  5073. }
  5074. },
  5075. _renderemptyrow: function () {
  5076. if (this._loading) {return;}
  5077. if (this.dataview.records.length == 0 && this.showemptyrow) {
  5078. var l = false;
  5079. var e = this.toTP("jqx-grid-cell");
  5080. if (this.table && this.table.length > 0 && this.table[0].rows && this.table[0].rows.length > 0) {
  5081. var k = this.table[0].rows[0];
  5082. this.table[0].style.top = "0px";
  5083. for (var f = 0; f < k.cells.length; f++) {
  5084. var d = b(k.cells[f]);
  5085. if (d.css("display") != "none" && !l) {
  5086. d[0].checkbox = null;
  5087. d[0].button = null;
  5088. d[0].className = e;
  5089. l = true;
  5090. d[0].innerHTML = "";
  5091. var g = b("<span style='white-space: nowrap; float: left; margin-left: 50%; position: relative;'></span>");
  5092. g.text(this.gridlocalization.emptydatastring);
  5093. d.append(g);
  5094. var j = 0;
  5095. if (!this.oldhscroll) {
  5096. j = parseInt(this.table[0].style.marginLeft);
  5097. if (this.rtl) {
  5098. d.css("z-index", 999);
  5099. d.css("overflow", "visible");
  5100. }
  5101. }
  5102. g.css("left", -j - (g.width() / 2));
  5103. g.css("top", this._gettableheight() / 2 - g.height() / 2);
  5104. if (b.jqx.browser.msie && b.jqx.browser.version < 8) {
  5105. g.css("margin-left", "0px");
  5106. g.css("left", this.host.width() / 2 - g.width() / 2);
  5107. }
  5108. var h = Math.abs(parseInt(this.table[0].style.top));
  5109. if (isNaN(h)) {h = 0;}
  5110. b(k).height(this._gettableheight() + h);
  5111. d.css("margin-left", "0px");
  5112. d.width(this.host.width());
  5113. if (this.table.width() < this.host.width()) {this.table.width(this.host.width());}
  5114. }
  5115. d.addClass(this.toThemeProperty("jqx-grid-empty-cell"));
  5116. }
  5117. }
  5118. }
  5119. },
  5120. _clearvisualrows: function () {
  5121. var e = this.virtualsizeinfo.visiblerecords;
  5122. var f = this.hScrollInstance;
  5123. var d = f.value;
  5124. var g = parseInt(d);
  5125. var i = this.groupable && this.groups.length > 0;
  5126. if (!this.columns.records) {return;}
  5127. for (var h = 0; h < e; h++) {this._clearvisualrow(g, i, h, 0, this.columns.records.length);}
  5128. },
  5129. _iscellselected: function (j, i, g) {
  5130. var f = false;
  5131. var e = 0;
  5132. if (this.virtualmode && this.pageable && this.groupable) {if (this.groups.length > 0) {e = this.dataview.pagesize * this.dataview.pagenum;}}
  5133. if (this.groups.length > 0 && this.pageable && this.groupable) {
  5134. var d = this.getrowboundindexbyid(i.bounddata.uid);
  5135. if (d != -1) {
  5136. for (var h in this.selectedcells) {if (h == d + "_" + g) {f = true;}}
  5137. return f;
  5138. }
  5139. return false;
  5140. }
  5141. if (j && i.bounddata != null) {
  5142. if (this.selectionmode != "singlerow") {
  5143. if (this.dataview.filters.length > 0) {if (!this.virtualmode && i.bounddata.dataindex != undefined) {for (var h in this.selectedcells) {if (h == e + i.bounddata.dataindex + "_" + g) {f = true;}}} else {for (var h in this.selectedcells) {if (h == e + i.bounddata.boundindex + "_" + g) {f = true;}}}} else {
  5144. for (var h in this.selectedcells) {
  5145. if (h == e + i.bounddata.boundindex + "_" + g) {
  5146. f = true;
  5147. break;
  5148. }
  5149. }
  5150. }
  5151. } else {
  5152. if (this.dataview.filters.length > 0) {
  5153. if (!this.virtualmode && i.bounddata.dataindex != undefined) {
  5154. for (var h in this.selectedcells) {
  5155. if (h == e + i.bounddata.dataindex + "_" + g) {
  5156. f = true;
  5157. break;
  5158. }
  5159. }
  5160. } else {
  5161. for (var h in this.selectedcells) {
  5162. if (h == e + i.bounddata.boundindex + "_" + g) {
  5163. f = true;
  5164. break;
  5165. }
  5166. }
  5167. }
  5168. } else {
  5169. for (var h in this.selectedcells) {
  5170. if (h == e + i.bounddata.boundindex == this.selectedrowindex) {
  5171. f = true;
  5172. break;
  5173. }
  5174. }
  5175. }
  5176. }
  5177. }
  5178. return f;
  5179. },
  5180. _isrowselected: function (h, g) {
  5181. var f = false;
  5182. var e = 0;
  5183. if (this.virtualmode && this.pageable && this.groupable) {if (this.groups.length > 0) {e = this.dataview.pagesize * this.dataview.pagenum;}}
  5184. if (this.groupable && this.groups.length > 0 && this.pageable) {
  5185. var d = this.getrowboundindexbyid(g.bounddata.uid);
  5186. if (d == undefined || d == -1) {return false;}
  5187. if (this.selectedrowindexes.indexOf(d) != -1) {f = true;}
  5188. if (!f) {f = d == this.selectedrowindex && this.selectedrowindex != -1;}
  5189. return f;
  5190. }
  5191. if (h && g.bounddata != null) {if (this.selectionmode != "singlerow") {if (this.dataview.filters.length > 0) {if (!this.virtualmode && g.bounddata.dataindex != undefined) {if (this.selectedrowindexes.indexOf(e + g.bounddata.dataindex) != -1) {f = true;}} else {if (this.selectedrowindexes.indexOf(e + g.bounddata.boundindex) != -1) {f = true;}}} else {if (this.selectedrowindexes.indexOf(e + g.bounddata.boundindex) != -1) {f = true;}}} else {if (this.dataview.filters.length > 0) {if (!this.virtualmode && g.bounddata.dataindex != undefined) {if (this.selectedrowindexes.indexOf(e + g.bounddata.dataindex) != -1) {f = true;}} else {if (this.selectedrowindexes.indexOf(e + g.bounddata.boundindex) != -1) {f = true;}}} else {if (e + g.bounddata.boundindex == this.selectedrowindex) {f = true;}}}}
  5192. return f;
  5193. },
  5194. _rendervisualcell: function (D, j, s, l, x, B, k, t, d, i, w, q) {
  5195. var f = null;
  5196. var g = this.columns.records[i];
  5197. if (g.hidden || g.adaptivehidden) {
  5198. var e = t.cells[i];
  5199. e.innerHTML = "";
  5200. return;
  5201. }
  5202. var o = this._getcellvalue(g, d);
  5203. var e = t.cells[i];
  5204. var A = j;
  5205. if (this.selectionmode.indexOf("cell") != -1) {
  5206. if (this.dataview.filters.length > 0) {if (this.selectedcells[d.bounddata.dataindex + "_" + g.datafield]) {s = true;} else {s = false;}} else {if (this.selectedcells[d.boundindex + "_" + g.datafield]) {s = true;} else {s = false;}}
  5207. if (this.editcell) {if (this.editcell.row === d.boundindex && this.editcell.column === g.datafield) {if (g.columntype !== "checkbox") {s = false;}}}
  5208. if (this.virtualmode || (this.groupable && this.groups.length > 0 && this.pageable)) {s = this._iscellselected(true, d, g.datafield);}
  5209. }
  5210. if (g.cellclassname != "" && g.cellclassname) {
  5211. if (typeof g.cellclassname == "string") {A += " " + g.cellclassname;} else {
  5212. var p = g.cellclassname(this.getboundindex(d), g.datafield, o, d.bounddata);
  5213. if (p) {A += " " + p;}
  5214. }
  5215. }
  5216. var r = this.showsortcolumnbackground && this.sortcolumn && g.displayfield == this.sortcolumn;
  5217. if (this.sortmode === "many" && this.showsortcolumnbackground) {
  5218. var h = this.getsortcolumns();
  5219. for (var v = 0; v < h.length; v++) {if (g.displayfield === h[v].dataField) {r = true;}}
  5220. }
  5221. if (r) {A += " " + this.toTP("jqx-grid-cell-sort");}
  5222. if (g.filter && this.showfiltercolumnbackground) {A += " " + this.toTP("jqx-grid-cell-filter");}
  5223. if (d.bounddata.totalsrow) {A += " " + this.toTP("jqx-grid-cell-pinned");}
  5224. if ((g.pinned && this.showpinnedcolumnbackground) || g.grouped) {if (B) {if (!d.bounddata.totalsrow) {A += " " + this.toTP("jqx-grid-cell-pinned");} else {}} else {A += " " + this.toTP("jqx-grid-cell-pinned");}}
  5225. if (this.altrows && d.group == undefined) {
  5226. var C = d.visibleindex;
  5227. if (C >= this.altstart) {
  5228. if ((this.altstart + C) % (1 + this.altstep) == 0) {
  5229. if (!r) {A += " " + this.toTP("jqx-grid-cell-alt");} else {A += " " + this.toTP("jqx-grid-cell-sort-alt");}
  5230. if (g.filter && this.showfiltercolumnbackground) {A += " " + this.toTP("jqx-grid-cell-filter-alt");}
  5231. if (g.pinned && this.showpinnedcolumnbackground) {A += " " + this.toTP("jqx-grid-cell-pinned-alt");}
  5232. }
  5233. }
  5234. }
  5235. if (i <= k) {
  5236. if (B || this.rowdetails || (this.pageable && this.virtualmode)) {
  5237. var y = b(e);
  5238. var n = this.columns.records[i].width;
  5239. if (e.style.width != parseInt(n) + "px") {y.width(n);}
  5240. }
  5241. } else {
  5242. if (B || this.rowdetails) {
  5243. if (this._hiddencolumns) {
  5244. var y = b(e);
  5245. var n = this.columns.records[i].width;
  5246. if (parseInt(e.style.width) != n) {y.width(n);}
  5247. }
  5248. }
  5249. }
  5250. var z = true;
  5251. if (this.rowdetails && l) {
  5252. if (x && !B) {A += " " + this.toTP("jqx-grid-details-cell");} else {if (B) {A += " " + this.toTP("jqx-grid-group-details-cell");}}
  5253. if (this.showrowdetailscolumn) {
  5254. if (!this.rtl) {
  5255. if (d.group == undefined && i == k && !d.bounddata.totalsrow) {
  5256. var u = this.toThemeProperty("jqx-icon-arrow-down");
  5257. if (x) {
  5258. A += " " + this.toTP("jqx-grid-group-expand");
  5259. A += " " + u;
  5260. } else {
  5261. A += " " + this.toTP("jqx-grid-group-collapse");
  5262. var u = this.toThemeProperty("jqx-icon-arrow-right");
  5263. A += " " + u;
  5264. }
  5265. z = false;
  5266. e.title = "";
  5267. e.innerHTML = "";
  5268. if (e.className != A) {e.className = A;}
  5269. return;
  5270. }
  5271. } else {
  5272. if (d.group == undefined && i == t.cells.length - k - 1) {
  5273. var u = this.toThemeProperty("jqx-icon-arrow-down");
  5274. if (x) {
  5275. A += " " + this.toTP("jqx-grid-group-expand-rtl");
  5276. A += " " + u;
  5277. } else {
  5278. A += " " + this.toTP("jqx-grid-group-collapse-rtl");
  5279. var u = this.toThemeProperty("jqx-icon-arrow-left");
  5280. A += " " + u;
  5281. }
  5282. z = false;
  5283. e.title = "";
  5284. e.innerHTML = "";
  5285. if (e.className != A) {e.className = A;}
  5286. return;
  5287. }
  5288. }
  5289. }
  5290. }
  5291. if (s && z && i >= k) {
  5292. A += " " + this.toTP("jqx-grid-cell-selected");
  5293. A += " " + this.toTP("jqx-fill-state-pressed");
  5294. }
  5295. if (e.className != A) {e.className = A;}
  5296. g._applyCellStyle(e);
  5297. if (d.group != undefined) {
  5298. o = "";
  5299. e.title = "";
  5300. e.innerHTML = "";
  5301. return;
  5302. }
  5303. D(this, g, d, o, e, q);
  5304. },
  5305. _rendercell: function (v, f, k, t, d, r) {
  5306. var g = t + "_" + f.visibleindex;
  5307. if (f.columntype == "number" || f.cellsrenderer != null) {var g = k.uniqueid + "_" + f.visibleindex;}
  5308. if (f.columntype == "number") {t = k.visibleindex;}
  5309. if (f.columntype === "adaptive") {t = "...";}
  5310. f._applyCellStyle(d);
  5311. if (v.showrowlines) {d.style.borderBottomColor = "";} else {d.style.borderBottomColor = "transparent";}
  5312. if (v.showcolumnheaderlines) {
  5313. f.element.style.borderRightColor = "";
  5314. f.element.style.boxShadow = "";
  5315. } else {
  5316. f.element.style.borderRightColor = "transparent";
  5317. f.element.style.boxShadow = "none";
  5318. }
  5319. if (v.showcolumnlines) {d.style.borderRightColor = "";} else {d.style.borderRightColor = "transparent";}
  5320. if (v.editcell && v.editrow == undefined) {
  5321. if (v.editmode == "selectedrow" && f.editable && v.editable) {
  5322. if (v.editcell.row == v.getboundindex(k)) {
  5323. if (v._showcelleditor) {
  5324. if (!v.hScrollInstance.isScrolling() && !v.vScrollInstance.isScrolling()) {v._showcelleditor(v.editcell.row, f, d, v.editcell.init);} else {v._showcelleditor(v.editcell.row, f, d, false, false);}
  5325. d.className += " " + v.toTP("jqx-grid-cell-edit");
  5326. return;
  5327. }
  5328. }
  5329. } else {
  5330. if (v.editcell.row == v.getboundindex(k) && v.editcell.column == f.datafield) {
  5331. v.editcell.element = d;
  5332. if (v.editcell.editing) {
  5333. if (v._showcelleditor) {
  5334. if (!v.hScrollInstance.isScrolling() && !v.vScrollInstance.isScrolling()) {v._showcelleditor(v.editcell.row, f, v.editcell.element, v.editcell.init);} else {v._showcelleditor(v.editcell.row, f, v.editcell.element, v.editcell.init, false);}
  5335. d.className += " " + v.toTP("jqx-grid-cell-edit");
  5336. return;
  5337. }
  5338. }
  5339. }
  5340. }
  5341. }
  5342. var s = v._defaultcellsrenderer(t, f);
  5343. var o = v._cellscache[g];
  5344. if (o) {
  5345. if (f.columntype == "checkbox") {
  5346. if (v.host.jqxCheckBox) {
  5347. if (t === "") {t = null;}
  5348. var n = d.innerHTML.toString().length == 0;
  5349. if (d.checkbox && !v.groupable && !n) {
  5350. d.checkboxrow = v.getboundindex(k);
  5351. if (t == "") {t = false;}
  5352. if (t == "1") {t = true;}
  5353. if (t == "0") {t = false;}
  5354. if (t == 1) {t = true;}
  5355. if (t == 0) {t = false;}
  5356. if (t == "true") {t = true;}
  5357. if (t == "false") {t = false;}
  5358. if (t == null && !f.threestatecheckbox) {t = false;}
  5359. if (f.checkboxcolumn) {
  5360. t = false;
  5361. if (v.dataview.filters.length > 0 && !v.virtualmode && k.bounddata.dataindex != undefined) {if (v.selectedrowindexes.indexOf(k.bounddata.dataindex) != -1) {t = true;}} else {if (v.selectedrowindexes.indexOf(k.bounddata.boundindex) != -1) {t = true;}}
  5362. }
  5363. if (!v.disabled) {if (d.checkboxinstance) {d.checkboxinstance._setState(t);} else {d.checkbox.jqxCheckBox("_setState", t);}}
  5364. } else {v._rendercheckboxcell(v, d, f, k, t);}
  5365. if (f.cellsrenderer != null) {
  5366. var h = f.cellsrenderer(v.getboundindex(k), f.datafield, t, s, f.getcolumnproperties(), k.bounddata);
  5367. if (h != undefined) {d.innerHTML = h;}
  5368. }
  5369. return;
  5370. }
  5371. } else {
  5372. if (f.columntype == "button") {
  5373. if (v.host.jqxButton) {
  5374. if (t == "") {t = false;}
  5375. if (f.cellsrenderer != null) {t = f.cellsrenderer(v.getboundindex(k), f.datafield, t, s, f.getcolumnproperties(), k.bounddata);}
  5376. if (d.innerHTML == "") {
  5377. d.buttonrow = v.getboundindex(k);
  5378. d.button = null;
  5379. v._renderbuttoncell(v, d, f, k, t);
  5380. }
  5381. if (d.button && !v.groupable) {
  5382. d.buttonrow = v.getboundindex(k);
  5383. d.button.val(t);
  5384. } else {v._renderbuttoncell(v, d, f, k, t);}
  5385. return;
  5386. }
  5387. }
  5388. }
  5389. if (f.createwidget) {
  5390. if (d.innerHTML == "") {
  5391. d.widgetrow = v.getboundindex(k);
  5392. d.widget = null;
  5393. f.widget = null;
  5394. v._renderwidgetcell(v, d, f, k, t);
  5395. }
  5396. if (d.widget && !v.groupable) {
  5397. d.widgetrow = v.getboundindex(k);
  5398. if (f.initwidget) {f.initwidget(v.getboundindex(k), f.datafield, t, d.firstChild);} else {throw new Error("jqxGrid: 'initwidget' column function is not implemented. Please, implement 'initwidget'");}
  5399. } else {v._renderwidgetcell(v, d, f, k, t);}
  5400. return;
  5401. }
  5402. var u = o.element;
  5403. if (f.cellsrenderer != null || (d.childNodes && d.childNodes.length == 0) || v.groupable || v.rowdetails) {if (d.innerHTML != u) {d.innerHTML = u;}} else {
  5404. if (d.innerHTML.indexOf("editor") >= 0) {d.innerHTML = u;} else {
  5405. if (r) {
  5406. var p = u.indexOf(">");
  5407. var m = u.indexOf("</");
  5408. var q = u.substring(p + 1, m);
  5409. var i = d.childNodes[0];
  5410. if (q.indexOf(">") >= 0) {d.innerHTML = u;} else {
  5411. if (i.childNodes[0]) {if (q != i.childNodes[0].nodeValue) {if (q.indexOf("&") >= 0) {d.innerHTML = u;} else {i.childNodes[0].nodeValue = q;}}} else {
  5412. var e = document.createTextNode(q);
  5413. i.appendChild(e);
  5414. }
  5415. }
  5416. } else {if (d.innerHTML != u) {d.innerHTML = u;}}
  5417. }
  5418. }
  5419. if (v.enabletooltips && f.enabletooltips) {d.title = o.title;}
  5420. return;
  5421. }
  5422. if (f.columntype == "checkbox") {
  5423. v._rendercheckboxcell(v, d, f, k, t);
  5424. v._cellscache[g] = { element: "", title: t };
  5425. if (v.enabletooltips && f.enabletooltips) {d.title = "" + t;}
  5426. return;
  5427. } else {
  5428. if (f.columntype == "button") {
  5429. if (f.cellsrenderer != null) {t = f.cellsrenderer(v.getboundindex(k), f.datafield, t, s, f.getcolumnproperties(), k.bounddata);}
  5430. v._renderbuttoncell(v, d, f, k, t);
  5431. v._cellscache[g] = { element: "", title: t };
  5432. if (v.enabletooltips && f.enabletooltips) {d.title = "" + t;}
  5433. return;
  5434. } else {if (f.columntype == "number") {t = k.visibleindex;}}
  5435. }
  5436. if (f.createwidget) {
  5437. if (f.cellsrenderer != null) {t = f.cellsrenderer(v.getboundindex(k), f.datafield, t, s, f.getcolumnproperties(), k.bounddata);}
  5438. v._renderwidgetcell(v, d, f, k, t);
  5439. v._cellscache[g] = { element: "", title: t };
  5440. if (v.enabletooltips && f.enabletooltips) {d.title = t;}
  5441. return;
  5442. }
  5443. var u = null;
  5444. if (f.cellsrenderer != null) {
  5445. u = f.cellsrenderer(v.getboundindex(k), f.datafield, t, s, f.getcolumnproperties(), k.bounddata);
  5446. if (u && (u.indexOf("<jqx-") >= 0 || u.indexOf(" ng-") >= 0)) {
  5447. if (v.toCompile) {v.toCompile.push({ cell: d, value: u, row: v.getboundindex(k) });}
  5448. return;
  5449. }
  5450. } else {u = s;}
  5451. if (u == null) {u = s;}
  5452. var l = t;
  5453. if (v.enabletooltips && f.enabletooltips) {
  5454. if (f.cellsformat != "") {if (b.jqx.dataFormat) {if (b.jqx.dataFormat.isDate(t)) {l = b.jqx.dataFormat.formatdate(l, f.cellsformat, v.gridlocalization);} else {if (b.jqx.dataFormat.isNumber(t)) {l = b.jqx.dataFormat.formatnumber(l, f.cellsformat, v.gridlocalization);}}}}
  5455. d.title = l;
  5456. }
  5457. if (v.WinJS) {b(d).html(u);} else {
  5458. var j = d.innerHTML;
  5459. if (j.indexOf("editor") >= 0 || f.cellsrenderer != null || v.groupable || v.virtualmode) {d.innerHTML = u;} else {
  5460. if (j.length > 0) {
  5461. var p = u.indexOf(">");
  5462. var m = u.indexOf("</");
  5463. var q = u.substring(p + 1, m);
  5464. var i = d.childNodes[0];
  5465. if (q.indexOf(">") >= 0) {d.innerHTML = u;} else {
  5466. if (i.childNodes[0]) {if (q != i.childNodes[0].nodeValue) {if (q.indexOf("&") >= 0 || j.indexOf("span") >= 0) {d.innerHTML = u;} else {i.childNodes[0].nodeValue = q;}}} else {
  5467. var e = document.createTextNode(q);
  5468. i.appendChild(e);
  5469. }
  5470. }
  5471. } else {if (j != u) {d.innerHTML = u;}}
  5472. }
  5473. }
  5474. v._cellscache[g] = { element: d.innerHTML, title: l };
  5475. return true;
  5476. },
  5477. _isIE10: function () {
  5478. if (this._browser == undefined) {
  5479. var e = b.jqx.utilities.getBrowser();
  5480. if (e.browser == "msie" && parseInt(e.version) > 9) {this._browser = true;} else {
  5481. this._browser = false;
  5482. if (e.browser == "msie") {
  5483. var d = "Browser CodeName: " + navigator.appCodeName + "";
  5484. d += "Browser Name: " + navigator.appName + "";
  5485. d += "Browser Version: " + navigator.appVersion + "";
  5486. d += "Platform: " + navigator.platform + "";
  5487. d += "User-agent header: " + navigator.userAgent + "";
  5488. if (d.indexOf("Zune 4.7") != -1) {this._browser = true;}
  5489. }
  5490. }
  5491. }
  5492. return this._browser;
  5493. },
  5494. _renderinlinecell: function (f, d, e, i, g) {
  5495. var h = b(d);
  5496. d.innerHTML = '<div style="position: absolute;"></div>';
  5497. },
  5498. _rendercheckboxcell: function (g, e, f, k, h) {
  5499. if (g.host.jqxCheckBox) {
  5500. var j = b(e);
  5501. if (h === "") {if (f.threestatecheckbox) {h = null;} else {h = false;}}
  5502. if (h === null && !f.threestatecheckbox) {h = false;}
  5503. if (h == "1") {h = true;}
  5504. if (h == "0") {h = false;}
  5505. if (h == 1) {h = true;}
  5506. if (h == 0) {h = false;}
  5507. if (h == "true") {h = true;}
  5508. if (h == "false") {h = false;}
  5509. if (f.checkboxcolumn) {
  5510. h = false;
  5511. var d = this.getboundindex(k);
  5512. if (this.selectedrowindexes.indexOf(d) != -1) {h = true;}
  5513. }
  5514. if (j.find(".jqx-checkbox").length == 0) {
  5515. e.innerHTML = '<div style="position: absolute; top: 50%; left: 50%; margin-top: -9px; margin-left: -12px;"></div>';
  5516. b(e.firstChild).jqxCheckBox({ disabled: g.disabled, _canFocus: false, hasInput: false, hasThreeStates: f.threestatecheckbox, enableContainerClick: false, animationShowDelay: 0, animationHideDelay: 0, locked: true, theme: g.theme, checked: h });
  5517. if (this.enabletooltips && f.enabletooltips) {e.title = "" + h;}
  5518. if (this.editable && f.editable) {b(e.firstChild).jqxCheckBox({ locked: false });}
  5519. if (f.checkboxcolumn) {b(e.firstChild).jqxCheckBox({ locked: false });}
  5520. e.checkbox = b(e.firstChild);
  5521. e.checkboxinstance = e.checkbox.data().jqxCheckBox.instance;
  5522. e.checkboxrow = this.getboundindex(k);
  5523. var i = b.data(e.firstChild, "jqxCheckBox").instance;
  5524. i.updated = function (l, s, m) {
  5525. if (g.disabled) {
  5526. s = m;
  5527. var p = g.table[0].rows.length;
  5528. var r = g._getcolumnindex(f.datafield);
  5529. for (var o = 0; o < p; o++) {
  5530. var n = g.table[0].rows[o].cells[r].firstChild;
  5531. if (n) {b(n).jqxCheckBox({ disabled: g.disabled });}
  5532. }
  5533. }
  5534. if (f.editable && !g.disabled) {
  5535. var p = g.table[0].rows.length;
  5536. var r = g._getcolumnindex(f.datafield);
  5537. if (g.editrow == undefined) {
  5538. if (f.cellbeginedit) {
  5539. var u = f.cellbeginedit(e.checkboxrow, f.datafield, f.columntype, !s);
  5540. if (u == false) {
  5541. g.setcellvalue(e.checkboxrow, f.datafield, !s, true);
  5542. return;
  5543. }
  5544. }
  5545. if (f.cellvaluechanging) {
  5546. var t = f.cellvaluechanging(e.checkboxrow, f.datafield, f.columntype, m, s);
  5547. if (t != undefined) {s = t;}
  5548. }
  5549. if (g.editmode !== "selectedrow") {
  5550. for (var o = 0; o < p; o++) {
  5551. var n = g.table[0].rows[o].cells[r].firstChild;
  5552. if (n) {b(n).jqxCheckBox("destroy");}
  5553. }
  5554. }
  5555. if (g.editcell && g.editcell.validated == false) {g.setcellvalue(e.checkboxrow, f.datafield, !s, true);} else {
  5556. if (g.editmode !== "selectedrow" || g.editcell == null) {
  5557. var q = g.getrowdata(e.checkboxrow);
  5558. g._raiseEvent(17, { rowindex: e.checkboxrow, row: q, datafield: f.datafield, value: m, columntype: f.columntype });
  5559. g.setcellvalue(e.checkboxrow, f.datafield, s, true);
  5560. g._raiseEvent(18, { rowindex: e.checkboxrow, row: q, datafield: f.datafield, oldvalue: m, value: s, columntype: f.columntype });
  5561. } else {g.setcellvalue(e.checkboxrow, f.datafield, s, false, false);}
  5562. }
  5563. if (f.cellendedit) {f.cellendedit(e.checkboxrow, f.datafield, f.columntype, s);}
  5564. }
  5565. } else {
  5566. if (f.checkboxcolumn) {
  5567. if (g.editcell) {g.endcelledit(g.editcell.row, g.editcell.column, false, true);}
  5568. if (!g.disabled) {
  5569. if (s) {g.selectrow(e.checkboxrow);} else {g.unselectrow(e.checkboxrow);}
  5570. if (g.autosavestate) {if (g.savestate) {g.savestate();}}
  5571. }
  5572. }
  5573. }
  5574. };
  5575. } else {
  5576. e.checkboxrow = this.getboundindex(k);
  5577. b(e.firstChild).jqxCheckBox("_setState", h, !(this.editable && f.editable) && !f.checkboxcolumn);
  5578. }
  5579. }
  5580. },
  5581. _renderwidgetcell: function (f, d, e, i, g) {
  5582. var h = b(d);
  5583. if (h.find(".jqx-grid-widget").length == 0) {
  5584. var j = '<div class="jqx-grid-widget" style="opacity: 0.99; position: absolute; width: 100%; height:100%; top: 0%; left: 0%; padding: 0px;"></div>';
  5585. d.innerHTML = j;
  5586. e.createwidget(i, e.datafield, g, d.firstChild);
  5587. b(d.firstChild).attr("hideFocus", "true");
  5588. b(d.firstChild).children().addClass("jqx-grid-widget");
  5589. d.widget = b(d.firstChild);
  5590. d.widgetrow = f.getboundindex(i);
  5591. e.widget = b(d.firstChild);
  5592. } else {
  5593. e.initwidget(f.getboundindex(i), e.datafield, g, d.firstChild);
  5594. d.widgetrow = f.getboundindex(i);
  5595. b(d.firstChild).val(g);
  5596. }
  5597. },
  5598. _renderbuttoncell: function (h, e, g, k, i) {
  5599. if (h.host.jqxButton) {
  5600. var j = b(e);
  5601. if (i == "") {i = false;}
  5602. if (j.find(".jqx-button").length == 0) {
  5603. e.innerHTML = '<input type="button" style="opacity: 0.99; position: absolute; top: 0%; left: 0%; padding: 0px; margin-top: 2px; margin-left: 2px;"/>';
  5604. b(e.firstChild).val(i);
  5605. b(e.firstChild).attr("hideFocus", "true");
  5606. b(e.firstChild).jqxButton({ disabled: h.disabled, theme: h.theme, height: h.rowsheight - 4, width: g.width - 4 });
  5607. e.button = b(e.firstChild);
  5608. e.buttonrow = h.getboundindex(k);
  5609. var d = this.isTouchDevice();
  5610. if (d) {
  5611. var f = b.jqx.mobile.getTouchEventName("touchend");
  5612. h.addHandler(b(e.firstChild), f, function (l) {if (g.buttonclick) {g.buttonclick(e.buttonrow, l);}});
  5613. } else {h.addHandler(b(e.firstChild), "click", function (l) {if (g.buttonclick) {g.buttonclick(e.buttonrow, l);}});}
  5614. } else {
  5615. e.buttonrow = h.getboundindex(k);
  5616. b(e.firstChild).val(i);
  5617. }
  5618. }
  5619. },
  5620. _clearvisualrow: function (g, f, o, i, n) {
  5621. var m = this.toTP("jqx-grid-cell");
  5622. if (f) {m = " " + this.toTP("jqx-grid-group-cell");}
  5623. m += " " + this.toTP("jqx-grid-cleared-cell");
  5624. var p = this.table[0].rows;
  5625. for (var k = 0; k < i + n; k++) {
  5626. if (p[o]) {
  5627. var e = p[o].cells[k];
  5628. if (e.className != m) {e.className = m;}
  5629. var d = this.columns.records[k];
  5630. if (this._horizontalvalue != g && !d.pinned) {
  5631. if (this.oldhscroll == true) {
  5632. var h = -g;
  5633. e.style.marginLeft = -g + "px";
  5634. }
  5635. }
  5636. var l = d.width;
  5637. if (d.adaptivewidth) {l = d.adaptivewidth;}
  5638. if (l < d.minwidth) {l = d.minwidth;}
  5639. if (l > d.maxwidth) {l = d.maxwidth;}
  5640. if (parseInt(e.style.width) != l) {if (l != "auto") {b(e)[0].style.width = l + "px";} else {b(e)[0].style.width = l;}}
  5641. if (e.title != "") {e.title = "";}
  5642. if (e.innerHTML != "") {e.innerHTML = "";}
  5643. }
  5644. }
  5645. if (p[o]) {if (parseInt(p[o].style.height) != this.rowsheight) {p[o].style.height = parseInt(this.rowsheight) + "px";}}
  5646. },
  5647. _findgroupstate: function (e) {
  5648. var d = this._findgroup(e);
  5649. if (d == null) {return false;}
  5650. return d.expanded;
  5651. },
  5652. _findgroup: function (e) {
  5653. var d = null;
  5654. if (this.expandedgroups[e]) {return this.expandedgroups[e];}
  5655. return d;
  5656. },
  5657. _clearcaches: function () {
  5658. this._columnsbydatafield = new Array();
  5659. this._pagescache = new Array();
  5660. this._pageviews = new Array();
  5661. this._cellscache = new Array();
  5662. this.heights = new Array();
  5663. this.hiddens = new Array();
  5664. this.hiddenboundrows = new Array();
  5665. this.heightboundrows = new Array();
  5666. this.detailboundrows = new Array();
  5667. this.details = new Array();
  5668. this.expandedgroups = new Array();
  5669. this._rowdetailscache = new Array();
  5670. this._rowdetailselementscache = new Array();
  5671. if (b.jqx.dataFormat) {b.jqx.dataFormat.cleardatescache();}
  5672. this.tableheight = null;
  5673. },
  5674. _getColumnText: function (d) {
  5675. if (this._columnsbydatafield == undefined) {this._columnsbydatafield = new Array();}
  5676. if (this._columnsbydatafield[d]) {return this._columnsbydatafield[d];}
  5677. var f = d;
  5678. var e = null;
  5679. b.each(this.columns.records, function () {
  5680. if (this.datafield == d || this.displayfield == d) {
  5681. f = this.text;
  5682. e = this;
  5683. return false;
  5684. }
  5685. });
  5686. this._columnsbydatafield[d] = { label: f, column: e };
  5687. return this._columnsbydatafield[d];
  5688. },
  5689. _getcolumnbydatafield: function (d) {
  5690. if (this.__columnsbydatafield == undefined) {this.__columnsbydatafield = new Array();}
  5691. if (this.__columnsbydatafield[d]) {return this.__columnsbydatafield[d];}
  5692. var f = d;
  5693. var e = null;
  5694. b.each(this.columns.records, function () {
  5695. if (this.datafield == d || this.displayfield == d) {
  5696. f = this.text;
  5697. e = this;
  5698. return false;
  5699. }
  5700. });
  5701. this.__columnsbydatafield[d] = e;
  5702. return this.__columnsbydatafield[d];
  5703. },
  5704. isscrollingvertically: function () {
  5705. var d = (this.vScrollBar.jqxScrollBar("isScrolling"));
  5706. return d;
  5707. },
  5708. _renderrowdetails: function (q, y, d, x, n, A) {
  5709. if (y == undefined) {return;}
  5710. var E = b(y);
  5711. var g = 0;
  5712. var t = this.rowdetails && this.showrowdetailscolumn ? (1 + this.groups.length) * this.groupindentwidth : (this.groups.length) * this.groupindentwidth;
  5713. if (this.groupable && this.groups.length > 0) {
  5714. for (var r = 0; r <= n; r++) {
  5715. var e = b(y.cells[r]);
  5716. e[0].innerHTML = "";
  5717. e[0].className = "jqx-grid-details-cell";
  5718. }
  5719. }
  5720. var e = b(y.cells[g]);
  5721. if (e[0].style.display == "none") {
  5722. var o = y.cells[g];
  5723. var B = 2;
  5724. var l = g;
  5725. while (o != undefined && o.style.display == "none" && B < 10) {
  5726. o = y.cells[l + B - 1];
  5727. B++;
  5728. }
  5729. e = b(o);
  5730. }
  5731. if (this.rtl) {
  5732. for (var v = x; v < n; v++) {
  5733. y.cells[v].innerHTML = "";
  5734. y.cells[v].className = "jqx-grid-details-cell";
  5735. }
  5736. }
  5737. e.css("width", "100%");
  5738. E.height(d.rowdetailsheight);
  5739. e[0].className = q;
  5740. var p = this.getboundindex(d);
  5741. var j = p + "_";
  5742. if (this._rowdetailscache[j]) {
  5743. var u = this._rowdetailscache[j];
  5744. var C = u.html;
  5745. if (this.initrowdetails) {
  5746. if (this._rowdetailscache[j].element) {
  5747. var f = this._rowdetailscache[j].element;
  5748. var i = e.coord();
  5749. var z = this.gridcontent.coord();
  5750. var w = parseInt(i.top) - parseInt(z.top);
  5751. var k = parseInt(i.left) - parseInt(z.left);
  5752. if (this.rtl) {k = 0;}
  5753. b(f).css("top", w);
  5754. b(f).css("left", k);
  5755. b(f).css("display", "block");
  5756. b(f).width(this.host.width() - t);
  5757. if (this.layoutrowdetails) {this.layoutrowdetails(p, f, this.element, this.getrowdata(p));}
  5758. }
  5759. } else {e[0].innerHTML = C;}
  5760. return;
  5761. }
  5762. e[0].innerHTML = "";
  5763. if (!this.enablerowdetailsindent) {t = 0;}
  5764. var h = '<div class="jqx-enableselect" role="rowgroup" style="border: none; overflow: hidden; width: 100%; height: 100%; margin-left: ' + t + 'px;">' + d.rowdetails + "</div>";
  5765. if (this.rtl) {var h = '<div class="jqx-enableselect" role="rowgroup" style="border: none; overflow: hidden; width: 100%; height: 100%; margin-left: ' + 0 + "px; margin-right: " + t + 'px;">' + d.rowdetails + "</div>";}
  5766. this._rowdetailscache[j] = { id: y.id, html: h };
  5767. if (this.initrowdetails) {
  5768. var f = b(h)[0];
  5769. b(this.gridcontent).prepend(b(f));
  5770. b(f).css("position", "absolute");
  5771. b(f).width(this.host.width() - t);
  5772. b(f).height(e.height());
  5773. var i = e.coord();
  5774. b(f).css("z-index", 799);
  5775. if (this.isTouchDevice()) {b(f).css("z-index", 999);}
  5776. b(f).addClass(this.toThemeProperty("jqx-widget-content"));
  5777. var i = e.coord();
  5778. var z = this.gridcontent.coord();
  5779. var w = parseInt(i.top) - parseInt(z.top);
  5780. var k = parseInt(i.left) - parseInt(z.left);
  5781. b(f).css("top", w);
  5782. b(f).css("left", k);
  5783. this.content[0].scrollTop = 0;
  5784. this.content[0].scrollLeft = 0;
  5785. var D = b(b(f).children()[0]);
  5786. if (D[0].id != "") {D[0].id = D[0].id + p;}
  5787. this.initrowdetails(p, f, this.element, this.getrowdata(p));
  5788. this._rowdetailscache[j].element = f;
  5789. this._rowdetailselementscache[p] = f;
  5790. } else {e[0].innerHTML = h;}
  5791. },
  5792. _defaultcellsrenderer: function (f, d) {
  5793. if (d.cellsformat != "") {if (b.jqx.dataFormat) {if (b.jqx.dataFormat.isDate(f)) {f = b.jqx.dataFormat.formatdate(f, d.cellsformat, this.gridlocalization);} else {if (b.jqx.dataFormat.isNumber(f)) {f = b.jqx.dataFormat.formatnumber(f, d.cellsformat, this.gridlocalization);}}}}
  5794. var e = "8px";
  5795. if (this.rowsheight != 31) {
  5796. e = (this.rowsheight / 2 - this._cellheight / 2);
  5797. if (e < 0) {e = 4;}
  5798. e += "px";
  5799. }
  5800. if (this.enableellipsis) {
  5801. if (d.cellsalign == "center" || d.cellsalign == "middle") {return '<div class="jqx-grid-cell-middle-align" style="margin-top: ' + e + ';">' + f + "</div>";}
  5802. if (d.cellsalign == "left") {return '<div class="jqx-grid-cell-left-align" style="margin-top: ' + e + ';">' + f + "</div>";}
  5803. if (d.cellsalign == "right") {return '<div class="jqx-grid-cell-right-align" style="margin-top: ' + e + ';">' + f + "</div>";}
  5804. }
  5805. if (d.cellsalign == "center" || d.cellsalign == "middle") {return '<div style="text-align: center; margin-top: ' + e + ';">' + f + "</div>";}
  5806. return '<span style="margin-left: 4px; margin-right: 2px; margin-top: ' + e + "; float: " + d.cellsalign + ';">' + f + "</span>";
  5807. },
  5808. getcelltext: function (g, e) {
  5809. if (g == null || e == null) {return null;}
  5810. var d = this.getcellvalue(g, e);
  5811. var f = this.getcolumn(e);
  5812. if (f && f.cellsformat != "") {if (b.jqx.dataFormat) {if (b.jqx.dataFormat.isDate(d)) {d = b.jqx.dataFormat.formatdate(d, f.cellsformat, this.gridlocalization);} else {if (b.jqx.dataFormat.isNumber(d)) {d = b.jqx.dataFormat.formatnumber(d, f.cellsformat, this.gridlocalization);}}}}
  5813. return d;
  5814. },
  5815. getcelltextbyid: function (g, e) {
  5816. if (g == null || e == null) {return null;}
  5817. var d = this.getcellvaluebyid(g, e);
  5818. var f = this.getcolumn(e);
  5819. if (f && f.cellsformat != "") {if (b.jqx.dataFormat) {if (b.jqx.dataFormat.isDate(d)) {d = b.jqx.dataFormat.formatdate(d, f.cellsformat, this.gridlocalization);} else {if (b.jqx.dataFormat.isNumber(d)) {d = b.jqx.dataFormat.formatnumber(d, f.cellsformat, this.gridlocalization);}}}}
  5820. return d;
  5821. },
  5822. _getcellvalue: function (d, f) {
  5823. var e = null;
  5824. e = f.bounddata[d.datafield];
  5825. if (d.displayfield != null) {e = f.bounddata[d.displayfield];}
  5826. if (e == null) {e = "";}
  5827. return e;
  5828. },
  5829. getcell: function (h, d) {
  5830. if (h == null || d == null) {return null;}
  5831. var e = parseInt(h);
  5832. var g = h;
  5833. var f = "";
  5834. if (!isNaN(e)) {g = this.getrowdata(e);}
  5835. if (g != null) {f = g[d];}
  5836. return this._getcellresult(f, h, d);
  5837. },
  5838. getrenderedcell: function (h, d) {
  5839. if (h == null || d == null) {return null;}
  5840. var e = parseInt(h);
  5841. var g = h;
  5842. var f = "";
  5843. if (!isNaN(e)) {g = this.getrenderedrowdata(e);}
  5844. if (g != null) {f = g[d];}
  5845. return this._getcellresult(f, h, d);
  5846. },
  5847. _getcellresult: function (k, n, e) {
  5848. var f = this.getcolumn(e);
  5849. if (f == null || f == undefined) {return null;}
  5850. var i = f.getcolumnproperties();
  5851. var g = i.hidden;
  5852. var d = i.width;
  5853. var m = i.pinned;
  5854. var h = i.cellsalign;
  5855. var j = i.cellsformat;
  5856. var l = this.getrowheight(n);
  5857. if (l == false) {return null;}
  5858. return { value: k, row: n, column: e, datafield: e, width: d, height: l, hidden: g, pinned: m, align: h, format: j };
  5859. },
  5860. setcellvaluebyid: function (i, d, h, f, g) {
  5861. var e = this.getrowboundindexbyid(i);
  5862. return this.setcellvalue(e, d, h, f, g);
  5863. },
  5864. getcellvaluebyid: function (f, d) {
  5865. var e = this.getrowboundindexbyid(f);
  5866. return this.getcellvalue(e, d);
  5867. },
  5868. setcellvalue: function (o, F, H, Q, j) {
  5869. if (o == null || F == null) {return false;}
  5870. var h = parseInt(o);
  5871. var t = h;
  5872. var C = o;
  5873. if (!isNaN(h)) {C = this.getrowdata(h);}
  5874. var N = false;
  5875. if (this.filterable && this._initfilterpanel && this.dataview.filters.length) {N = true;}
  5876. if (this.virtualmode) {this._pagescache = new Array();}
  5877. if (this.sortcache) {this.sortcache = {};}
  5878. var q = "";
  5879. var d = "";
  5880. if (C != null && C[F] !== H) {
  5881. if (C[F] === null && H === "") {return;}
  5882. var I = this._getcolumnbydatafield(F);
  5883. var R = "string";
  5884. var v = this.source.datafields || ((this.source._source) ? this.source._source.datafields : null);
  5885. if (v) {
  5886. var D = "";
  5887. b.each(v, function () {
  5888. if (this.name == I.displayfield) {
  5889. if (this.type) {D = this.type;}
  5890. return false;
  5891. }
  5892. });
  5893. if (D) {R = D;}
  5894. d = C[I.displayfield];
  5895. }
  5896. q = C[F];
  5897. if (!I.nullable || (H != null && H !== "" && I.nullable && H.label === undefined)) {
  5898. if (b.jqx.dataFormat.isNumber(q) || R == "number" || R == "float" || R == "int" || R == "decimal" && R != "date") {
  5899. if (this.gridlocalization && this.gridlocalization.decimalseparator == ",") {if (H && H.indexOf && H.indexOf(",") >= 0) {H = H.replace(",", ".");}}
  5900. H = new Number(H);
  5901. H = parseFloat(H);
  5902. if (isNaN(H)) {H = 0;}
  5903. } else {
  5904. if (b.jqx.dataFormat.isDate(q) || R == "date") {
  5905. if (H != "") {
  5906. var L = H;
  5907. L = new Date(L);
  5908. if (L != "Invalid Date" && L != null) {H = L;} else {
  5909. if (L == "Invalid Date") {
  5910. L = new Date();
  5911. H = L;
  5912. }
  5913. }
  5914. }
  5915. }
  5916. }
  5917. if (C[F] === H) {
  5918. if (!this._updating && Q != false) {this._renderrows(this.virtualsizeinfo);}
  5919. return;
  5920. }
  5921. }
  5922. var A = this.source && this.source._source.localdata && this.source._source.localdata.name === "observableArray";
  5923. C[F] = H;
  5924. if (A) {
  5925. var P = this.source._source.localdata;
  5926. if (!P._updating) {
  5927. P._updating = true;
  5928. P[o][F] = H;
  5929. P._updating = false;
  5930. }
  5931. }
  5932. var l = this.getrenderedrowdata(h, true);
  5933. if (!l) {return;}
  5934. l[F] = H;
  5935. if (H != null && H.label != null) {
  5936. var I = this._getcolumnbydatafield(F);
  5937. C[I.displayfield] = H.label;
  5938. l[I.displayfield] = H.label;
  5939. C[F] = H.value;
  5940. l[F] = H.value;
  5941. if (A && !P._updating) {
  5942. P._updating = true;
  5943. P[o][F] = H.value;
  5944. P[o][I.displayfield] = H.label;
  5945. P._updating = false;
  5946. }
  5947. }
  5948. if (N) {
  5949. if (C.dataindex != undefined) {
  5950. t = C.dataindex;
  5951. this.dataview.cachedrecords[C.dataindex][F] = H;
  5952. if (H != null && H.label != undefined) {
  5953. this.dataview.cachedrecords[C.dataindex][F] = H.value;
  5954. this.dataview.cachedrecords[C.dataindex][I.displayfield] = H.label;
  5955. }
  5956. }
  5957. }
  5958. } else {
  5959. if (!this._updating && Q != false) {this._renderrows(this.virtualsizeinfo);}
  5960. return false;
  5961. }
  5962. if (this.source && this.source._knockoutdatasource && !this._updateFromAdapter && this.autokoupdates) {
  5963. if (this.source._source._localdata) {
  5964. var E = h;
  5965. if (N) {if (C.dataindex != undefined) {E = C.dataindex;}}
  5966. var g = this.source._source._localdata()[E];
  5967. this.source.suspendKO = true;
  5968. var G = g;
  5969. if (G[F] && G[F].subscribe) {
  5970. if (H != null && H.label != null) {
  5971. G[I.displayfield](H.label);
  5972. G[F](H.value);
  5973. } else {G[F](H);}
  5974. } else {
  5975. var v = this.source._source.datafields;
  5976. var B = null;
  5977. var x = null;
  5978. if (v) {
  5979. b.each(v, function () {
  5980. if (this.name == F) {
  5981. x = this.map;
  5982. return false;
  5983. }
  5984. });
  5985. }
  5986. if (x == null) {
  5987. if (H != null && H.label != null) {
  5988. G[F] = H.value;
  5989. G[I.displayfield] = H.label;
  5990. } else {G[F] = H;}
  5991. } else {
  5992. var f = x.split(this.source.mapChar);
  5993. if (f.length > 0) {
  5994. var n = G;
  5995. for (var M = 0; M < f.length - 1; M++) {n = n[f[M]];}
  5996. n[f[f.length - 1]] = H;
  5997. }
  5998. }
  5999. this.source._source._localdata.replace(g, b.extend({}, G));
  6000. }
  6001. this.source.suspendKO = false;
  6002. }
  6003. }
  6004. if (this.sortcolumn && this.dataview.sortby && !this._updating) {
  6005. var z = this.getsortinformation();
  6006. if (this.sortcolumn == F && this.sortmode !== "many") {
  6007. this.dataview.clearsortdata();
  6008. this.dataview.sortby(z.sortcolumn, z.sortdirection.ascending);
  6009. } else {
  6010. if (this.sortmode === "many") {
  6011. var m = this.getsortcolumns();
  6012. this.dataview.clearsortdata();
  6013. this.sortby(null);
  6014. for (var O = 0; O < m.length; O++) {this.sortby(m[O].dataField, m[O].ascending);}
  6015. }
  6016. }
  6017. } else {if (!this._updating) {if (this.dataview.sortby) {if (this.dataview.sortcache[F]) {this.dataview.sortcache[F] = null;}}}}
  6018. this._cellscache = new Array();
  6019. this._pagescache = new Array();
  6020. if (this.source.updaterow && (j == undefined || j == true)) {
  6021. var J = false;
  6022. var r = this.that;
  6023. var s = function (i) {
  6024. if (false == i) {
  6025. r.setcellvalue(o, F, q, true, false);
  6026. if (q != d) {r.setcellvalue(o, r.getcolumn(F).displayfield, d, true, false);}
  6027. }
  6028. };
  6029. try {
  6030. var k = this.getrowid(h);
  6031. J = this.source.updaterow(k, C, s);
  6032. if (J == undefined) {J = true;}
  6033. } catch (w) {
  6034. J = false;
  6035. r.setcellvalue(o, F, q, true, false);
  6036. if (q != d) {r.setcellvalue(o, r.getcolumn(F).displayfield, d, true, false);}
  6037. return;
  6038. }
  6039. }
  6040. var K = this.vScrollInstance.value;
  6041. if (this._updating && Q != true) {Q = false;}
  6042. if (Q == true || Q == undefined) {
  6043. var r = this.that;
  6044. var e = function () {
  6045. if (r.pageable && r.updatepagerdetails) {
  6046. r.updatepagerdetails();
  6047. if (r.autoheight || r.autorowheight) {r._updatepageviews();}
  6048. }
  6049. };
  6050. var u = this.groupable && this.groups.length > 0;
  6051. if (N && !u) {
  6052. if (this.autoheight || this.autorowheight) {this.prerenderrequired = true;}
  6053. this.dataview.refresh();
  6054. this.rendergridcontent(true, false);
  6055. e();
  6056. this._renderrows(this.virtualsizeinfo);
  6057. } else {
  6058. if (this.sortcolumn && !u) {
  6059. if (this.autoheight || this.autorowheight) {this.prerenderrequired = true;}
  6060. this.dataview.reloaddata();
  6061. this.rendergridcontent(true, false);
  6062. e();
  6063. this._renderrows(this.virtualsizeinfo);
  6064. } else {
  6065. if (this.groupable && this.groups.length > 0) {
  6066. if (this.autoheight || this.autorowheight) {this.prerenderrequired = true;}
  6067. if (this.pageable) {
  6068. if (this.groups.indexOf(F) != -1) {
  6069. this._pagescache = new Array();
  6070. this._cellscache = new Array();
  6071. this.dataview.refresh();
  6072. this._render(true, true, false, false);
  6073. } else {
  6074. this._pagescache = new Array();
  6075. this._cellscache = new Array();
  6076. this.dataview.updateview();
  6077. this._renderrows(this.virtualsizeinfo);
  6078. }
  6079. } else {
  6080. this._pagescache = new Array();
  6081. this._cellscache = new Array();
  6082. this.dataview.updateview();
  6083. this._renderrows(this.virtualsizeinfo);
  6084. }
  6085. } else {
  6086. this.dataview.updateview();
  6087. this._renderrows(this.virtualsizeinfo);
  6088. }
  6089. }
  6090. }
  6091. }
  6092. this.vScrollInstance.setPosition(K);
  6093. if (this.showaggregates && this._updatecolumnsaggregates) {this._updatecolumnsaggregates();}
  6094. if (this.showfilterrow && this.filterable && this.filterrow) {
  6095. var y = this.getcolumn(F).filtertype;
  6096. if (y == "list" || y == "checkedlist") {this._updatelistfilters(true);}
  6097. }
  6098. this._raiseEvent(19, { rowindex: o, datafield: F, newvalue: H, value: H, oldvalue: q });
  6099. return true;
  6100. },
  6101. getcellvalue: function (h, d) {
  6102. if (h == null || d == null) {return null;}
  6103. var e = parseInt(h);
  6104. var g = h;
  6105. if (!isNaN(e)) {g = this.getrowdata(e);}
  6106. if (g != null) {
  6107. var f = g[d];
  6108. return f;
  6109. }
  6110. return null;
  6111. },
  6112. getrows: function () {
  6113. var h = this.dataview.records.length;
  6114. if (this.virtualmode) {
  6115. var j = new Array();
  6116. for (var e = 0; e < this.dataview.records.length; e++) {
  6117. var d = this.dataview.records[e];
  6118. if (d) {j.push(d);}
  6119. }
  6120. if (this.dataview.records.length === undefined) {
  6121. b.each(this.dataview.records, function () {
  6122. var i = this;
  6123. if (i) {j.push(i);}
  6124. });
  6125. }
  6126. var g = 0;
  6127. if (this.pageable) {g = this.dataview.pagenum * this.dataview.pagesize;}
  6128. if (j.length > this.source._source.totalrecords - g) {return j.slice(0, this.source._source.totalrecords - g);}
  6129. return j;
  6130. }
  6131. if (this.dataview.sortdata) {
  6132. var j = new Array();
  6133. for (var e = 0; e < h; e++) {
  6134. var f = {};
  6135. f = b.extend({}, this.dataview.sortdata[e].value);
  6136. j[e] = f;
  6137. }
  6138. return j;
  6139. } else {return this.dataview.records;}
  6140. },
  6141. getrowboundindexbyid: function (g) {
  6142. var f = this.dataview.recordsbyid["id" + g];
  6143. if (f) {if (f.boundindex) {return this.getboundindex(f);}}
  6144. var e = this.getboundrows();
  6145. for (var d = 0; d < e.length; d++) {if (e[d]) {if (e[d].uid == g) {return d;}}}
  6146. return -1;
  6147. },
  6148. getrowdatabyid: function (f) {
  6149. var e = this.dataview.recordsbyid["id" + f];
  6150. if (e) {return e;} else {
  6151. var d = this.getrowboundindexbyid(f);
  6152. return this.getboundrows()[d];
  6153. }
  6154. return null;
  6155. },
  6156. getrowdata: function (d) {
  6157. if (d == undefined) {d = 0;}
  6158. if (this.virtualmode) {
  6159. var e = this.dataview.records[d];
  6160. return e;
  6161. } else {
  6162. var e = this.getboundrows()[d];
  6163. return e;
  6164. }
  6165. return null;
  6166. },
  6167. getrenderedrowdata: function (d, f) {
  6168. if (d == undefined) {d = 0;}
  6169. if (this.virtualmode) {
  6170. var g = this.getrowvisibleindex(d);
  6171. var e = this.dataview.loadedrecords[g];
  6172. return e;
  6173. }
  6174. var g = this.getrowvisibleindex(d);
  6175. if (g >= 0) {
  6176. if (this.groupable && this.groups.length > 0) {var e = this.dataview.loadedrecords[g];} else {
  6177. var e = this.dataview.loadedrecords[g];
  6178. if (this.pageable && (f == undefined || f == false)) {var e = this.dataview.loadedrecords[this.dataview.pagesize * this.dataview.pagenum + d];}
  6179. }
  6180. return e;
  6181. }
  6182. return null;
  6183. },
  6184. getboundrows: function () {return this.dataview.cachedrecords;},
  6185. getrowdisplayindex: function (d) {
  6186. var f = this.getdisplayrows();
  6187. for (var e = 0; e < f.length; e++) {
  6188. if (!f[e]) {continue;}
  6189. if (f[e].dataindex !== undefined) {if (f[e].dataindex == d) {return f[e].visibleindex;}} else {if (f[e].boundindex == d) {return f[e].visibleindex;}}
  6190. }
  6191. return -1;
  6192. },
  6193. getboundindex: function (e) {
  6194. var d = e.boundindex;
  6195. if (this.groupable && this.groups.length > 0 && this.pageable) {if (e.bounddata) {d = this.getrowboundindexbyid(e.bounddata.uid);}}
  6196. if (this.dataview.filters.length > 0) {if (e.bounddata) {if (e.bounddata.dataindex !== undefined) {d = e.bounddata.dataindex;}} else {if (e.dataindex !== undefined) {d = e.dataindex;}}}
  6197. return d;
  6198. },
  6199. getrowboundindex: function (d) {
  6200. var e = this.getdisplayrows()[d];
  6201. if (e) {
  6202. if (e.dataindex !== undefined) {return e.dataindex;}
  6203. return e.boundindex;
  6204. }
  6205. return -1;
  6206. },
  6207. getdisplayrows: function () {return this.dataview.loadedrecords;},
  6208. getloadedrows: function () {return this.getdisplayrows();},
  6209. getvisiblerowdata: function (e) {
  6210. var d = this.getvisiblerows();
  6211. if (d) {return d[e];}
  6212. return null;
  6213. },
  6214. getloadedrowdata: function (e) {
  6215. var d = this.getloadedrows();
  6216. if (d) {return d[e];}
  6217. return null;
  6218. },
  6219. getvisiblerows: function () {
  6220. if (this.virtualmode) {return this.dataview.loadedrecords;}
  6221. if (this.pageable) {
  6222. var f = [];
  6223. for (var e = 0; e < this.dataview.pagesize; e++) {
  6224. var d = this.dataview.loadedrecords[e + (this.dataview.pagesize * this.dataview.pagenum)];
  6225. if (d == undefined) {break;}
  6226. f.push(d);
  6227. }
  6228. return f;
  6229. } else {
  6230. if (this._startboundindex != undefined && this._endboundindex != undefined) {
  6231. var f = [];
  6232. for (var e = this._startvisibleindex; e <= this._endvisibleindex; e++) {
  6233. var d = this.dataview.loadedrecords[e];
  6234. if (d == undefined) {break;}
  6235. f.push(d);
  6236. }
  6237. return f;
  6238. }
  6239. }
  6240. return this.dataview.loadedrecords;
  6241. },
  6242. getrowid: function (d) {
  6243. if (d == undefined) {d = 0;}
  6244. if (this.virtualmode) {
  6245. var g = this.getrowvisibleindex(d);
  6246. var f = this.dataview.loadedrecords[g];
  6247. if (f) {return f.uid;}
  6248. } else {
  6249. var f = null;
  6250. var e = this.dataview.filters.length > 0;
  6251. if (d >= 0 && d < this.dataview.bounditems.length && !e) {
  6252. if (this.groupable && this.groups.length > 0) {
  6253. var g = this.getrowvisibleindex(d);
  6254. var f = this.dataview.loadedrecords[g];
  6255. } else {
  6256. var g = this.getrowvisibleindex(d);
  6257. var f = this.dataview.loadedrecords[g];
  6258. }
  6259. if (f) {return f.uid;}
  6260. }
  6261. if (this.dataview.filters.length > 0) {
  6262. var f = this.getboundrows()[d];
  6263. if (f) {if (f.uid != null) {return f.uid;}}
  6264. return null;
  6265. }
  6266. }
  6267. return null;
  6268. },
  6269. _updateGridData: function (e) {
  6270. var d = false;
  6271. if (this.filterable && this._initfilterpanel && this.dataview.filters.length) {d = true;}
  6272. if (d) {
  6273. this.dataview.refresh();
  6274. if (e == "updaterow") {
  6275. this._render(true, true, false, false, false);
  6276. this.invalidate();
  6277. } else {this.render();}
  6278. } else {
  6279. if (this.sortcolumn || (this.groupable && this.groups.length > 0)) {
  6280. this.dataview.reloaddata();
  6281. this.render();
  6282. } else {
  6283. if (e === "updaterow") {
  6284. this.dataview.refresh();
  6285. if (!this.virtualmode) {this._render(true, true, false, false, false);}
  6286. }
  6287. this._cellscache = new Array();
  6288. this._pagescache = new Array();
  6289. this._renderrows(this.virtualsizeinfo);
  6290. }
  6291. }
  6292. if (this.showfilterrow && this.filterable && this.filterrow) {this._updatelistfilters(true);}
  6293. },
  6294. updaterow: function (i, k, g) {
  6295. if (i != undefined && k != undefined) {
  6296. var h = this.that;
  6297. var j = false;
  6298. h._datachanged = true;
  6299. var e = function (q, l, u) {
  6300. if (q._loading) {
  6301. throw new Error("jqxGrid: " + q.loadingerrormessage);
  6302. return false;
  6303. }
  6304. var s = false;
  6305. if (!b.isArray(l)) {s = q.dataview.updaterow(l, u);} else {
  6306. b.each(l, function (v, w) {s = q.dataview.updaterow(this, u[v], false);});
  6307. q._cellscache = new Array();
  6308. q._pagescache = new Array();
  6309. q.dataview.refresh();
  6310. }
  6311. var m = q.vScrollInstance.value;
  6312. if (g == undefined || g == true) {if (q._updating == undefined || q._updating == false) {q._updateGridData("updaterow");}}
  6313. if (q.showaggregates && q._updatecolumnsaggregates) {q._updatecolumnsaggregates();}
  6314. if (q.source && q.source._knockoutdatasource && !q._updateFromAdapter && q.autokoupdates) {
  6315. if (q.source._source._localdata) {
  6316. var n = q.dataview.recordsbyid["id" + l];
  6317. var o = q.dataview.records.indexOf(n);
  6318. var p = q.source._source._localdata()[o];
  6319. q.source.suspendKO = true;
  6320. q.source._source._localdata.replace(p, b.extend({}, n));
  6321. q.source.suspendKO = false;
  6322. }
  6323. }
  6324. var r = q.source && q.source._source.localdata && q.source._source.localdata.name === "observableArray";
  6325. if (r) {
  6326. if (!q.source._source.localdata._updating) {
  6327. q.source._source.localdata._updating = true;
  6328. var t = q.getrowboundindexbyid(l);
  6329. q.source._source.localdata.set(t, u);
  6330. q.source._source.localdata._updating = false;
  6331. }
  6332. }
  6333. q.vScrollInstance.setPosition(m);
  6334. return s;
  6335. };
  6336. if (this.source.updaterow) {
  6337. var d = function (l) {if (l == true || l == undefined) {e(h, i, k);} else {j = false;}};
  6338. try {
  6339. j = this.source.updaterow(i, k, d);
  6340. if (j == undefined) {j = true;}
  6341. } catch (f) {j = false;}
  6342. } else {j = e(h, i, k);}
  6343. return j;
  6344. }
  6345. return false;
  6346. },
  6347. deleterow: function (d, k) {
  6348. if (d != undefined) {
  6349. this._datachanged = true;
  6350. var o = false;
  6351. var m = this.that;
  6352. var p = this.getrowboundindexbyid(d);
  6353. var e = new Array();
  6354. var j = new Array();
  6355. if (p != undefined) {
  6356. if (this.selectedrowindexes.indexOf(p) >= 0) {this.selectedrowindexes.splice(this.selectedrowindexes.indexOf(p), 1);}
  6357. if (this.selectedrowindex == p) {this.selectedrowindex = -1;}
  6358. if (!this.virtualmode) {
  6359. if (m.selectionmode.indexOf("row") >= 0) {
  6360. b.each(this.selectedrowindexes, function () {
  6361. var q = m.getrowid(this);
  6362. e.push(q);
  6363. });
  6364. this.selectedrowindexes = new Array();
  6365. this.selectedrowindex = -1;
  6366. } else {
  6367. if (m.selectionmode.indexOf("cell") >= 0) {
  6368. for (var i in m.selectedcells) {
  6369. var n = m.selectedcells[i];
  6370. var h = m.getrowid(n.rowindex);
  6371. n.rowid = h;
  6372. }
  6373. }
  6374. }
  6375. this._rendervisualrows();
  6376. }
  6377. }
  6378. var f = function (w, r) {
  6379. if (w._loading) {
  6380. throw new Error("jqxGrid: " + w.loadingerrormessage);
  6381. return false;
  6382. }
  6383. var z = false;
  6384. var t = w.vScrollInstance.value;
  6385. if (!b.isArray(r)) {var z = w.dataview.deleterow(r);} else {
  6386. b.each(r, function () {z = w.dataview.deleterow(this, false);});
  6387. w._cellscache = new Array();
  6388. w._pagescache = new Array();
  6389. w.dataview.refresh();
  6390. }
  6391. if (!w.virtualmode) {
  6392. if (w.selectionmode.indexOf("row") >= 0) {
  6393. b.each(e, function () {
  6394. var B = w.getrowboundindexbyid(this);
  6395. if (B != -1) {w.selectrow(B, false);}
  6396. });
  6397. } else {
  6398. var A = new Array();
  6399. for (var v in w.selectedcells) {
  6400. var y = w.selectedcells[v];
  6401. var u = y.rowid;
  6402. var s = w.getrowboundindexbyid(u);
  6403. if (s != -1) {
  6404. y.rowindex = s;
  6405. A[s + "_" + y.datafield] = y;
  6406. }
  6407. }
  6408. w.selectedcells = A;
  6409. }
  6410. }
  6411. if (w._updating == undefined || w._updating == false) {
  6412. if (k == undefined || k == true) {
  6413. setTimeout(function () {
  6414. w._render(true, true, false, false);
  6415. if (w.vScrollBar.css("visibility") != "visible") {
  6416. w._arrange();
  6417. w._updatecolumnwidths();
  6418. w._updatecellwidths();
  6419. w._renderrows(w.virtualsizeinfo);
  6420. }
  6421. });
  6422. }
  6423. }
  6424. if (w.source && w.source._knockoutdatasource && !w._updateFromAdapter && w.autokoupdates) {
  6425. if (w.source._source._localdata) {
  6426. w.source.suspendKO = true;
  6427. w.source._source._localdata.pop();
  6428. w.source.suspendKO = false;
  6429. }
  6430. }
  6431. var x = w.source && w.source._source.localdata && w.source._source.localdata.name === "observableArray";
  6432. if (x) {
  6433. if (!w.source._source.localdata._updating) {
  6434. w.source._source.localdata._updating = true;
  6435. w.source._source.localdata.splice(p, 1);
  6436. w.source._source.localdata._updating = false;
  6437. }
  6438. }
  6439. if (w.dataview.sortby && w.sortmode !== "many") {
  6440. var q = w.getsortinformation();
  6441. if (q.sortcolumn) {
  6442. w.dataview.clearsortdata();
  6443. w.dataview.sortby(q.sortcolumn, q.sortdirection ? q.sortdirection.ascending : null);
  6444. }
  6445. }
  6446. w.vScrollInstance.setPosition(t);
  6447. return z;
  6448. };
  6449. if (this.source.deleterow) {
  6450. var g = function (q) {if (q == true || q == undefined) {f(m, d);}};
  6451. try {
  6452. this.source.deleterow(d, g);
  6453. if (o == undefined) {o = true;}
  6454. } catch (l) {o = false;}
  6455. } else {o = f(m, d);}
  6456. return o;
  6457. }
  6458. return false;
  6459. },
  6460. addrow: function (f, o, j) {
  6461. if (o != undefined) {
  6462. this._datachanged = true;
  6463. if (j == undefined) {j = "last";}
  6464. var n = false;
  6465. var m = this.that;
  6466. if (f == null) {
  6467. var g = this.dataview.filters && this.dataview.filters.length > 0;
  6468. var l = !g ? this.dataview.totalrecords : this.dataview.cachedrecords.length;
  6469. if (!b.isArray(o)) {
  6470. f = this.dataview.getid(this.dataview.source.id, o, l);
  6471. while (null != this.dataview.recordsbyid["id" + f]) {f++;}
  6472. } else {
  6473. var d = new Array();
  6474. b.each(o, function (e, p) {
  6475. var q = m.dataview.getid(m.dataview.source.id, o[e], l + e);
  6476. d.push(q);
  6477. });
  6478. f = d;
  6479. }
  6480. }
  6481. var h = function (s, r, v, e) {
  6482. if (s._loading) {
  6483. throw new Error("jqxGrid: " + s.loadingerrormessage);
  6484. return false;
  6485. }
  6486. var u = s.vScrollInstance.value;
  6487. var t = false;
  6488. if (!b.isArray(v)) {
  6489. if (v != undefined && v.dataindex != undefined) {delete v.dataindex;}
  6490. t = s.dataview.addrow(r, v, e);
  6491. } else {
  6492. b.each(v, function (w, x) {
  6493. if (this.dataindex != undefined) {delete this.dataindex;}
  6494. var y = null;
  6495. if (r != null && r[w] != null) {y = r[w];}
  6496. t = s.dataview.addrow(y, this, e, false);
  6497. });
  6498. s._cellscache = new Array();
  6499. s._pagescache = new Array();
  6500. s.dataview.refresh();
  6501. }
  6502. if (s._updating == undefined || s._updating == false) {
  6503. s._render(true, true, false, false);
  6504. s.invalidate();
  6505. }
  6506. if (s.source && s.source._knockoutdatasource && !s._updateFromAdapter && s.autokoupdates) {
  6507. if (s.source._source._localdata) {
  6508. s.source.suspendKO = true;
  6509. s.source._source._localdata.push(v);
  6510. s.source.suspendKO = false;
  6511. }
  6512. }
  6513. var p = s.source && s.source._source.localdata && s.source._source.localdata.name === "observableArray";
  6514. if (p) {
  6515. if (!s.source._source.localdata._updating) {
  6516. s.source._source.localdata._updating = true;
  6517. var q = s.getrowboundindexbyid(r);
  6518. s.source._source.localdata.set(q, v);
  6519. s.source._source.localdata._updating = false;
  6520. }
  6521. }
  6522. if (s.scrollmode != "deferred") {s.vScrollInstance.setPosition(u);} else {s.vScrollInstance.setPosition(0);}
  6523. return t;
  6524. };
  6525. if (this.source.addrow) {
  6526. var i = function (e, p) {
  6527. if (e == true || e == undefined) {
  6528. if (p != undefined) {f = p;}
  6529. h(m, f, o, j);
  6530. }
  6531. };
  6532. try {
  6533. n = this.source.addrow(f, o, j, i);
  6534. if (n == undefined) {n = true;}
  6535. } catch (k) {n = false;}
  6536. if (n == false) {return false;}
  6537. } else {h(this, f, o, j);}
  6538. return n;
  6539. }
  6540. return false;
  6541. },
  6542. _findvisiblerow: function (h, i) {
  6543. if (h == undefined) {h = parseInt(this.vScrollInstance.value);}
  6544. var f = 0;
  6545. if (i == undefined || i == null) {i = this.rows.records;}
  6546. var d = i.length;
  6547. while (f <= d) {
  6548. var e = parseInt((f + d) / 2);
  6549. var g = i[e];
  6550. if (g == undefined) {break;}
  6551. if (g.top > h && g.top + g.height > h) {d = e - 1;} else {
  6552. if (g.top < h && g.top + g.height < h) {f = e + 1;} else {
  6553. return e;
  6554. break;
  6555. }
  6556. }
  6557. }
  6558. return -1;
  6559. },
  6560. _updatecellwidths: function () {
  6561. var f = this.virtualsizeinfo;
  6562. if (!f) {return;}
  6563. var p = this.that;
  6564. if (p.gridcontent == undefined) {return;}
  6565. if (p.table == undefined) {p.table = p.gridcontent.find("#contenttable" + p.element.id);}
  6566. var k = p.groupable && p.groups.length > 0;
  6567. var q = 0;
  6568. var l = f.visiblerecords;
  6569. if (p.pageable && (p.autoheight || p.autorowheight)) {
  6570. l = p.dataview.pagesize;
  6571. if (p.groupable) {
  6572. p.dataview.updateview();
  6573. l = p.dataview.rows.length;
  6574. }
  6575. }
  6576. if (!p.groupable && !p.pageable && (p.autoheight || p.autorowheight)) {l = p.dataview.totalrecords;}
  6577. if (p.rowdetails) {l += p.dataview.pagesize;}
  6578. if (!p.columns.records) {return;}
  6579. var r = p.columns.records.length;
  6580. var t = p.table[0].rows;
  6581. for (var n = 0; n < l; n++) {
  6582. var d = t[n];
  6583. if (!d) {break;}
  6584. var s = d.cells;
  6585. var h = 0;
  6586. for (var m = 0; m < r; m++) {
  6587. var g = p.columns.records[m];
  6588. var e = g.width;
  6589. if (g.adaptivewidth) {e = g.adaptivewidth;}
  6590. var o = s[m];
  6591. if (parseInt(o.style.left) != h) {o.style.left = h + "px";}
  6592. if (parseInt(o.style.width) != e) {o.style.width = e + "px";}
  6593. if (!(g.hidden && g.hideable) && !g.adaptivehidden) {h += parseFloat(e);} else {o.style.display = "none";}
  6594. }
  6595. if (q == 0) {
  6596. p.table.width(parseFloat(h) + 2);
  6597. q = h;
  6598. }
  6599. }
  6600. if (p.showaggregates && p._updateaggregates) {p._updateaggregates();}
  6601. if (p.showfilterrow && p.filterable && p._updatefilterrowui) {p._updatefilterrowui();}
  6602. if (p.showeverpresentrow) {p._updateaddnewrowui();}
  6603. p._updatescrollbarsafterrowsprerender();
  6604. if (k) {p._renderrows(p.virtualsizeinfo);}
  6605. },
  6606. _updatescrollbarsafterrowsprerender: function () {
  6607. var g = this.that;
  6608. var f = g.hScrollBar[0].style.visibility;
  6609. var i = 0;
  6610. var d = g.vScrollBar[0].style.visibility;
  6611. if (d == "visible") {i = g.scrollbarsize + 3;}
  6612. if (g.scrollbarsize == 0) {i = 0;}
  6613. if (g.scrollbarautoshow) {i = 0;}
  6614. var e = g.element.style.width;
  6615. if (e.toString().indexOf("%") >= 0) {e = g.host.width();} else {e = parseInt(e);}
  6616. if (parseInt(g.table[0].style.width) - 2 > e - i) {
  6617. if (f != "visible") {
  6618. if (!g.autowidth) {g.hScrollBar[0].style.visibility = "visible";}
  6619. g._arrange();
  6620. }
  6621. if (d == "visible") {
  6622. if (g.scrollmode != "deferred" && !g.virtualmode) {
  6623. if (g.virtualsizeinfo) {
  6624. var h = g.virtualsizeinfo.virtualheight - g._gettableheight();
  6625. if (!isNaN(h) && h > 0) {if (f != "hidden") {g.vScrollBar.jqxScrollBar("max", h + g.scrollbarsize + 4);} else {g.vScrollBar.jqxScrollBar("max", h);}}
  6626. }
  6627. } else {g._updatevscrollbarmax();}
  6628. } else {i = -2;}
  6629. g.hScrollBar.jqxScrollBar("max", i + g.table.width() - g.host.width());
  6630. } else {
  6631. if (f != "hidden") {
  6632. g.hScrollBar.css("visibility", "hidden");
  6633. g._arrange();
  6634. }
  6635. }
  6636. g._renderhorizontalscroll();
  6637. },
  6638. _hascolumnstyle: function () {
  6639. if (undefined !== this._hascolumnstyles) {return this._hascolumnstyles;}
  6640. this._hascolumnstyles = false;
  6641. for (var d = 0; d < this.columns.records.length; d++) {
  6642. var e = this.columns.records[d];
  6643. if (e.style.headerBackgroundColor || e.style.headerColor || e.style.headerBackgroundHoveredColor || e.style.headerHoveredColor || e.style.headerBackgroundSelectedColor || e.style.headerSelectedColor || e.style.backgroundColor || e.style.color || e.style.backgroundHoveredColor || e.style.hoveredColor || e.style.backgroundSelectedColor || e.style.selectedColor) {
  6644. this._hascolumnstyles = true;
  6645. return true;
  6646. }
  6647. }
  6648. return false;
  6649. },
  6650. _prerenderrows: function (o) {
  6651. var C = this.that;
  6652. if (C.prerenderrequired == true) {
  6653. C.prerenderrequired = false;
  6654. if (C.editable && C._destroyeditors) {C._destroyeditors();}
  6655. if (C.gridcontent == undefined) {return;}
  6656. C.gridcontent.find("#contenttable" + C.element.id).remove();
  6657. if (C.table != null) {
  6658. C.table.remove();
  6659. C.table = null;
  6660. }
  6661. C.table = b('<div id="contenttable' + C.element.id + '" style="overflow: hidden; position: relative;"></div>');
  6662. C.gridcontent.addClass(C.toTP("jqx-grid-content"));
  6663. C.gridcontent.addClass(C.toTP("jqx-widget-content"));
  6664. C.gridcontent.append(C.table);
  6665. var B = C.groupable && C.groups.length > 0;
  6666. var p = 0;
  6667. C.table[0].rows = new Array();
  6668. var l = C.toTP("jqx-grid-cell");
  6669. if (B) {l = " " + C.toTP("jqx-grid-group-cell");}
  6670. var u = o.visiblerecords;
  6671. if (C.pageable && (C.autoheight || C.autorowheight)) {
  6672. u = C.dataview.pagesize;
  6673. if (C.groupable) {
  6674. C.dataview.updateview();
  6675. u = C.dataview.rows.length;
  6676. if (u < C.dataview.pagesize) {u = C.dataview.pagesize;}
  6677. }
  6678. }
  6679. if (!C.pageable && (C.autoheight || C.autorowheight)) {u = C.dataview.totalrecords;}
  6680. if (C.groupable && C.groups.length > 0 && (C.autoheight || C.autorowheight) && !C.pageable) {u = C.dataview.rows.length;}
  6681. if (C.rowdetails) {if (C.autoheight || C.autorowheight) {u += C.dataview.pagesize;} else {u += u;}}
  6682. if (!C.columns.records) {return;}
  6683. var A = C.columns.records.length;
  6684. if (b.jqx.browser.msie && b.jqx.browser.version > 8) {C.table.css("opacity", "0.99");}
  6685. if (b.jqx.browser.mozilla) {}
  6686. if (navigator.userAgent.indexOf("Safari") != -1) {C.table.css("opacity", "0.99");}
  6687. var r = b.jqx.browser.msie && b.jqx.browser.version < 8;
  6688. if (r) {C.host.attr("hideFocus", "true");}
  6689. var k = C.tableZIndex;
  6690. if (u * A > k) {k = u * A;}
  6691. var g = C.dataview.records.length == 0;
  6692. var n = C.isTouchDevice();
  6693. var v = "";
  6694. C._hiddencolumns = false;
  6695. var D = 5 + C.columns.records.length;
  6696. for (var z = 0; z < u; z++) {
  6697. var s = '<div role="row" style="position: relative; height:' + C.rowsheight + 'px;" id="row' + z + C.element.id + '">';
  6698. if (r) {
  6699. var s = '<div role="row" style="position: relative; z-index: ' + k + "; height:" + C.rowsheight + 'px;" id="row' + z + C.element.id + '">';
  6700. k--;
  6701. }
  6702. var f = 0;
  6703. for (var x = 0; x < A; x++) {
  6704. var w = C.columns.records[x];
  6705. var t = w.width;
  6706. if (t < w.minwidth) {t = w.minwidth;}
  6707. if (t > w.maxwidth) {t = w.maxwidth;}
  6708. if (C.rtl) {
  6709. var q = k - A + 2 * x;
  6710. var d = '<div columnindex="' + x + '" role="gridcell" style="left: ' + f + "px; z-index: " + q + "; width:" + t + "px;";
  6711. k--;
  6712. } else {var d = '<div columnindex="' + x + '" role="gridcell" style="left: ' + f + "px; z-index: " + k-- + "; width:" + t + "px;";}
  6713. if (!(w.hidden && w.hideable) && !w.adaptivehidden) {f += t;} else {
  6714. d += "display: none;";
  6715. C._hiddencolumns = true;
  6716. k++;
  6717. }
  6718. if (z === 0 && x === 0) {d += '" tabindex="' + D + '"';}
  6719. d += '" class="' + l + '">';
  6720. var y = this._defaultcellsrenderer("", w);
  6721. d += y;
  6722. d += "</div>";
  6723. s += d;
  6724. }
  6725. if (p == 0) {
  6726. C.table.width(parseInt(f) + 2);
  6727. p = f;
  6728. }
  6729. s += "</div>";
  6730. v += s;
  6731. }
  6732. if (C.WinJS) {MSApp.execUnsafeLocalFunction(function () {C.table.html(v);});} else {C.table[0].innerHTML = v;}
  6733. C.table[0].rows = new Array();
  6734. var m = C.table.children();
  6735. for (var z = 0; z < u; z++) {
  6736. var h = m[z];
  6737. C.table[0].rows.push(h);
  6738. h.cells = new Array();
  6739. var e = b(h).children();
  6740. for (var x = 0; x < A; x++) {h.cells.push(e[x]);}
  6741. }
  6742. if (u == 0) {
  6743. var f = 0;
  6744. if (C.showemptyrow) {
  6745. var s = b('<div style="position: relative;" id="row0' + C.element.id + '"></div>');
  6746. C.table.append(s);
  6747. s.height(C.rowsheight);
  6748. C.table[0].rows[0] = s[0];
  6749. C.table[0].rows[0].cells = new Array();
  6750. }
  6751. for (var x = 0; x < A; x++) {
  6752. var w = C.columns.records[x];
  6753. var t = w.width;
  6754. if (C.showemptyrow) {
  6755. var d = b('<div style="position: absolute; height: 100%; left: ' + f + "px; z-index: " + k-- + "; width:" + t + 'px;" class="' + l + '"></div>');
  6756. d.height(C.rowsheight);
  6757. s.append(d);
  6758. C.table[0].rows[0].cells[x] = d[0];
  6759. }
  6760. if (t < w.minwidth) {t = w.minwidth;}
  6761. if (t > w.maxwidth) {t = w.maxwidth;}
  6762. if (!(w.hidden && w.hideable) && !w.adaptivehidden) {f += t;}
  6763. }
  6764. C.table.width(parseInt(f) + 2);
  6765. p = f;
  6766. }
  6767. C._updatescrollbarsafterrowsprerender();
  6768. if (C.rendered) {C.rendered("rows");}
  6769. C.toCompile = new Array();
  6770. C._addoverlayelement();
  6771. }
  6772. },
  6773. _groupsheader: function () {return this.groupable && this.showgroupsheader;},
  6774. _arrange: function () {
  6775. var A = null;
  6776. var x = null;
  6777. this.tableheight = null;
  6778. var F = this.that;
  6779. var n = false;
  6780. var m = false;
  6781. if (F.width != null && F.width.toString().indexOf("px") != -1) {A = F.width;} else {if (F.width != undefined && !isNaN(F.width)) {A = F.width;}}
  6782. if (F.width != null && F.width.toString().indexOf("%") != -1) {
  6783. A = F.width;
  6784. n = true;
  6785. }
  6786. if (F.scrollbarautoshow) {
  6787. F.vScrollBar[0].style.display = "none";
  6788. F.hScrollBar[0].style.display = "none";
  6789. F.vScrollBar[0].style.zIndex = F.tableZIndex + F.headerZIndex;
  6790. F.hScrollBar[0].style.zIndex = F.tableZIndex + F.headerZIndex;
  6791. }
  6792. if (F.autowidth) {
  6793. var p = 0;
  6794. for (var B = 0; B < F.columns.records.length; B++) {
  6795. var e = F.columns.records[B].width;
  6796. if (e == "auto") {
  6797. e = F._measureElementWidth(F.columns.records[B].text);
  6798. p += e;
  6799. } else {p += e;}
  6800. }
  6801. if (F.vScrollBar.css("visibility") != "hidden") {p += F.scrollbarsize + 4;}
  6802. A = p;
  6803. F.width = A;
  6804. }
  6805. if (F.height != null && F.height.toString().indexOf("px") != -1) {x = F.height;} else {if (F.height != undefined && !isNaN(F.height)) {x = F.height;}}
  6806. if (F.height != null && F.height.toString().indexOf("%") != -1) {
  6807. x = F.height;
  6808. m = true;
  6809. }
  6810. var k = function () {
  6811. var i = 0;
  6812. var w = F.showheader ? F.columnsheader != null ? F.columnsheader.height() + 2 : 0 : 0;
  6813. i += w;
  6814. if (F.pageable) {i += F.pagerheight;}
  6815. if (F._groupsheader()) {i += F.groupsheaderheight;}
  6816. if (F.showtoolbar) {i += F.toolbarheight;}
  6817. if (F.showstatusbar) {i += F.statusbarheight;}
  6818. if (F.showeverpresentrow && F.everpresentrowposition === "bottom") {i += F.everpresentrowheight;}
  6819. if (F.hScrollBar[0].style.visibility == "visible") {i += 15;}
  6820. return i;
  6821. };
  6822. if (F.autoheight && F.virtualsizeinfo) {
  6823. if (F.pageable && F.gotopage) {
  6824. var C = 0;
  6825. x = C + (F._pageviews[0] ? F._pageviews[0].height : 0);
  6826. x += k();
  6827. if (F.showemptyrow && F.dataview.totalrecords == 0) {x += F.rowsheight;}
  6828. } else {
  6829. var C = F.host.height() - F._gettableheight();
  6830. if (F._pageviews.length > 0) {
  6831. x = C + F._pageviews[F._pageviews.length - 1].height + F._pageviews[F._pageviews.length - 1].top;
  6832. F.vScrollBar[0].style.visibility = "hidden";
  6833. } else {
  6834. x = k();
  6835. if (F.showemptyrow) {x += F.rowsheight;}
  6836. }
  6837. }
  6838. } else {
  6839. if (F.autoheight) {
  6840. x = F.dataview.totalrecords * F.rowsheight;
  6841. if (F.pageable && F.gotopage) {x = F.pagesize * F.rowsheight;}
  6842. if (F._loading) {
  6843. x = 250;
  6844. F.dataloadelement.height(x);
  6845. }
  6846. x += k();
  6847. if (x > 10000) {x = 10000;}
  6848. }
  6849. }
  6850. if (A != null) {
  6851. A = parseInt(A);
  6852. if (!n) {if (F.element.style.width != parseInt(F.width) + "px") {F.element.style.width = parseInt(F.width) + "px";}} else {F.element.style.width = F.width;}
  6853. if (n) {
  6854. A = F.host.width();
  6855. if (A <= 2) {
  6856. A = 600;
  6857. F.host.width(A);
  6858. }
  6859. if (!F._oldWidth) {F._oldWidth = A;}
  6860. }
  6861. } else {F.host.width(250);}
  6862. if (x != null) {
  6863. if (!m) {x = parseInt(x);}
  6864. if (!m) {if (F.element.style.height != parseInt(x) + "px") {F.element.style.height = parseInt(x) + "px";}} else {F.element.style.height = F.height;}
  6865. if (m && !F.autoheight) {
  6866. x = F.host.height();
  6867. if (x == 0) {
  6868. x = 400;
  6869. F.host.height(x);
  6870. }
  6871. if (!F._oldHeight) {F._oldHeight = x;}
  6872. }
  6873. } else {F.host.height(250);}
  6874. if (F.autoheight) {
  6875. F.tableheight = null;
  6876. F._gettableheight();
  6877. }
  6878. var v = 0;
  6879. if (F.showtoolbar) {
  6880. F.toolbar.width(A);
  6881. F.toolbar.height(F.toolbarheight - 1);
  6882. F.toolbar.css("top", 0);
  6883. v += F.toolbarheight;
  6884. x -= parseInt(F.toolbarheight);
  6885. } else {F.toolbar[0].style.height = "0px";}
  6886. if (F.showstatusbar) {
  6887. if (F.showaggregates) {F.statusbar.width(!F.table ? A : Math.max(A, F.table.width()));} else {F.statusbar.width(A);}
  6888. F.statusbar.height(F.statusbarheight);
  6889. } else {F.statusbar[0].style.height = "0px";}
  6890. if (F.showeverpresentrow && F.everpresentrowposition === "bottom") {
  6891. F.addnewrow.width(A);
  6892. F.addnewrow.height(F.everpresentrowheight);
  6893. } else {F.addnewrow[0].style.height = "0px";}
  6894. if (F._groupsheader()) {
  6895. F.groupsheader.width(A);
  6896. F.groupsheader.height(F.groupsheaderheight);
  6897. F.groupsheader.css("top", v);
  6898. var y = F.groupsheader.height() + 1;
  6899. v += y;
  6900. if (x > y) {x -= parseInt(y);}
  6901. } else {
  6902. if (F.groupsheader[0].style.width != A + "px") {F.groupsheader[0].style.width = parseInt(A) + "px";}
  6903. F.groupsheader[0].style.height = "0px";
  6904. if (F.groupsheader[0].style.top != v + "px") {F.groupsheader.css("top", v);}
  6905. var y = F.showgroupsheader && F.groupable ? F.groupsheaderheight : 0;
  6906. var f = v + y + "px";
  6907. if (F.content[0].style.top != f) {F.content.css("top", v + F.groupsheaderheight);}
  6908. }
  6909. var d = F.scrollbarsize;
  6910. if (isNaN(d)) {
  6911. d = parseInt(d);
  6912. if (isNaN(d)) {d = "17px";} else {d = d + "px";}
  6913. }
  6914. d = parseInt(d);
  6915. var s = 4;
  6916. var h = 2;
  6917. var j = 0;
  6918. if (F.vScrollBar[0].style.visibility == "visible") {j = d + s;}
  6919. if (F.hScrollBar[0].style.visibility == "visible") {h = d + s + 2;}
  6920. if (d == 0) {
  6921. j = 0;
  6922. h = 0;
  6923. }
  6924. var r = 0;
  6925. if (F.pageable) {
  6926. r = F.pagerheight;
  6927. h += F.pagerheight;
  6928. }
  6929. if (F.showstatusbar) {
  6930. h += F.statusbarheight;
  6931. r += F.statusbarheight;
  6932. }
  6933. if (F.showeverpresentrow && F.everpresentrowposition === "bottom") {
  6934. h += F.everpresentrowheight;
  6935. r += F.everpresentrowheight;
  6936. }
  6937. if (F.hScrollBar[0].style.height != d + "px") {F.hScrollBar[0].style.height = parseInt(d) + "px";}
  6938. if (F.hScrollBar[0].style.top != v + x - s - d - r + "px" || F.hScrollBar[0].style.left != "0px") {F.hScrollBar.css({ top: v + x - s - d - r + "px", left: "0px" });}
  6939. var q = F.hScrollBar[0].style.width;
  6940. var l = false;
  6941. var D = false;
  6942. if (j == 0) {
  6943. if (q != (A - 2) + "px") {
  6944. F.hScrollBar.width(A - 2);
  6945. l = true;
  6946. }
  6947. } else {
  6948. if (q != (A - d - s) + "px") {
  6949. F.hScrollBar.width(A - d - s + "px");
  6950. l = true;
  6951. }
  6952. }
  6953. if (!F.autoheight) {
  6954. if (F.vScrollBar[0].style.width != d + "px") {
  6955. F.vScrollBar.width(d);
  6956. D = true;
  6957. }
  6958. if (F.vScrollBar[0].style.height != parseInt(x) - h + "px") {
  6959. F.vScrollBar.height(parseInt(x) - h + "px");
  6960. D = true;
  6961. }
  6962. if (F.vScrollBar[0].style.left != parseInt(A) - parseInt(d) - s + "px" || F.vScrollBar[0].style.top != v + "px") {F.vScrollBar.css({ left: parseInt(A) - parseInt(d) - s + "px", top: v });}
  6963. }
  6964. if (F.rtl) {
  6965. F.vScrollBar.css({ left: "0px", top: v });
  6966. if (F.vScrollBar.css("visibility") != "hidden") {F.hScrollBar.css({ left: d + 2 });}
  6967. }
  6968. var o = F.vScrollInstance;
  6969. o.disabled = F.disabled;
  6970. if (!F.autoheight) {if (D) {o.refresh();}}
  6971. var z = F.hScrollInstance;
  6972. z.disabled = F.disabled;
  6973. if (l) {z.refresh();}
  6974. if (F.autowidth) {F.hScrollBar[0].style.visibility = "hidden";}
  6975. F.statusbarheight = parseInt(F.statusbarheight);
  6976. F.toolbarheight = parseInt(F.toolbarheight);
  6977. var t = function (w) {
  6978. if ((w.vScrollBar[0].style.visibility == "visible") && (w.hScrollBar[0].style.visibility == "visible")) {
  6979. w.bottomRight[0].style.visibility = "visible";
  6980. w.bottomRight.css({ left: 1 + parseInt(w.vScrollBar.css("left")), top: parseInt(w.hScrollBar.css("top")) });
  6981. if (w.rtl) {w.bottomRight.css("left", "0px");}
  6982. w.bottomRight.width(parseInt(d) + 3);
  6983. w.bottomRight.height(parseInt(d) + 4);
  6984. var G = w.showeverpresentrow && w.everpresentrowposition == "bottom";
  6985. var i = G ? w.everpresentrowheight : 0;
  6986. if (i > 0 && !w.showaggregates) {
  6987. w.bottomRight.css("z-index", 99);
  6988. w.bottomRight.height(parseInt(d) + 4 + i);
  6989. w.bottomRight.css({ top: parseInt(w.hScrollBar.css("top")) - i });
  6990. }
  6991. if (w.showaggregates) {
  6992. w.bottomRight.css("z-index", 99);
  6993. w.bottomRight.height(parseInt(d) + 4 + w.statusbarheight + i);
  6994. w.bottomRight.css({ top: parseInt(w.hScrollBar.css("top")) - w.statusbarheight - i });
  6995. }
  6996. } else {w.bottomRight[0].style.visibility = "hidden";}
  6997. };
  6998. t(this);
  6999. if (F.content[0].style.width != A - j + "px") {F.content.width(A - j);}
  7000. if (F.content[0].style.height != x - h + 3 + "px") {F.content.height(x - h + 3);}
  7001. if (F.scrollbarautoshow) {
  7002. if (F.content[0].style.width != A + "px") {F.content.width(A);}
  7003. if (F.content[0].style.height != x + "px") {F.content.height(x);}
  7004. }
  7005. if (F.content[0].style.top != v + "px") {F.content.css("top", v);}
  7006. if (F.rtl) {
  7007. F.content.css("left", j);
  7008. if (F.scrollbarautoshow) {F.content.css("left", "0px");}
  7009. if (F.table) {
  7010. var u = F.table.width();
  7011. if (u < A - j) {F.content.css("left", A - u);}
  7012. }
  7013. }
  7014. if (F.showstatusbar) {
  7015. F.statusbar.css("top", v + x - F.statusbarheight - (F.pageable ? F.pagerheight : 0));
  7016. if (F.showaggregates) {
  7017. if (F.hScrollBar.css("visibility") == "visible") {
  7018. F.hScrollBar.css({ top: v + x - s - d - r + F.statusbarheight + "px" });
  7019. F.statusbar.css("top", 1 + v + x - d - 5 - F.statusbarheight - (F.pageable ? F.pagerheight : 0));
  7020. }
  7021. t(this);
  7022. }
  7023. if (F.rtl) {if (F.hScrollBar.css("visibility") != "visible") {F.statusbar.css("left", F.content.css("left"));} else {F.statusbar.css("left", "0px");}}
  7024. }
  7025. if (F.showeverpresentrow && F.everpresentrowposition === "bottom") {
  7026. F.addnewrow.css("top", v + x - (F.showstatusbar ? F.statusbarheight : 0) - (F.pageable ? F.pagerheight : 0) - F.everpresentrowheight);
  7027. if (F.rtl) {if (F.hScrollBar.css("visibility") != "visible") {F.addnewrow.css("left", F.content.css("left"));} else {F.addnewrow.css("left", "0px");}}
  7028. }
  7029. if (F.pageable) {
  7030. F.pager.width(A);
  7031. F.pager.height(F.pagerheight);
  7032. F.pager.css("top", v + x - F.pagerheight - 1);
  7033. } else {F.pager[0].style.height = "0px";}
  7034. if (F.table != null) {
  7035. var g = -2;
  7036. if (F.vScrollBar[0].style.visibility == "visible") {g = F.scrollbarsize + 3;}
  7037. if (F.hScrollBar[0].style.visibility == "visible") {
  7038. var E = g + F.table.width() - F.host.width();
  7039. if (E >= 0) {F.hScrollBar.jqxScrollBar("max", E);}
  7040. if (F.hScrollBar[0].style.visibility == "visible" && E == 0) {
  7041. F.hScrollBar[0].style.visibility = "hidden";
  7042. F._arrange();
  7043. }
  7044. }
  7045. }
  7046. if (A != parseInt(F.dataloadelement[0].style.width)) {F.dataloadelement[0].style.width = F.element.style.width;}
  7047. if (x != parseInt(F.dataloadelement[0].style.height)) {F.dataloadelement[0].style.height = F.element.style.height;}
  7048. if (this.pagergotoinput) {
  7049. if (this.pagergotoinput.offset().top !== this.pagergoto.offset().top) {
  7050. this.pagergotoinput.css("visibility", "hidden");
  7051. this.pagergoto.css("visibility", "hidden");
  7052. } else {
  7053. this.pagergotoinput.css("visibility", "inherit");
  7054. this.pagergoto.css("visibility", "inherit");
  7055. }
  7056. }
  7057. F._hostwidth = A;
  7058. },
  7059. destroy: function () {
  7060. delete b.jqx.dataFormat.datescache;
  7061. delete this.gridlocalization;
  7062. b.jqx.utilities.resize(this.host, null, true);
  7063. if (document.referrer != "" || window.frameElement) {if (window.top != null && window.top != window.self) {this.removeHandler(b(window.top.document), "mouseup.grid" + this.element.id);}}
  7064. if (this.table && this.table[0]) {
  7065. var m = this.table[0].rows.length;
  7066. for (var k = 0; k < m; k++) {
  7067. var q = this.table[0].rows[k];
  7068. var p = q.cells;
  7069. var f = p.length;
  7070. for (var h = 0; h < f; h++) {
  7071. b(q.cells[h]).remove();
  7072. q.cells[h] = null;
  7073. delete q.cells[h];
  7074. }
  7075. q.cells = null;
  7076. if (q.cells) {delete q.cells;}
  7077. b(this.table[0].rows[k]).remove();
  7078. this.table[0].rows[k] = null;
  7079. }
  7080. try {delete this.table[0].rows;} catch (n) {}
  7081. this.table.remove();
  7082. delete this.table;
  7083. }
  7084. if (this.columns && this.columns.records) {
  7085. for (var k = 0; k < this.columns.records.length; k++) {
  7086. var e = this.columns.records[k];
  7087. if (e.addnewrowwidget) {if (e.destroyeverpresentrowwidget) {e.destroyeverpresentrowwidget(e.addnewrowwidget);}}
  7088. if (e.destroywidget) {if (e.destroywidget) {e.destroywidget(e.widget);}}
  7089. this._removecolumnhandlers(this.columns.records[k]);
  7090. if (e.element) {
  7091. b(e.element).remove();
  7092. b(e.sortasc).remove();
  7093. b(e.sortdesc).remove();
  7094. b(e.filtericon).remove();
  7095. b(e.menu).remove();
  7096. e.element = null;
  7097. e.uielement = null;
  7098. e.sortasc = null;
  7099. e.sortdesc = null;
  7100. e.filtericon = null;
  7101. e.menu = null;
  7102. delete e.element;
  7103. delete e.uielement;
  7104. delete e.sortasc;
  7105. delete e.sortdesc;
  7106. delete e.filtericon;
  7107. delete e.menu;
  7108. delete this.columnsrow[0].cells[k];
  7109. }
  7110. }
  7111. try {delete this.columnsrow[0].cells;} catch (n) {}
  7112. delete this.columnsrow;
  7113. }
  7114. b.removeData(document.body, "contextmenu" + this.element.id);
  7115. if (this.host.jqxDropDownList) {if (this._destroyfilterpanel) {this._destroyfilterpanel();}}
  7116. if (this.editable && this._destroyeditors) {this._destroyeditors();}
  7117. if (this.filterable && this._destroyedfilters && this.showfilterrow) {this._destroyedfilters();}
  7118. if (this.host.jqxMenu) {
  7119. if (this.gridmenu) {
  7120. this.removeHandler(b(document), "click.menu" + this.element.id);
  7121. this.removeHandler(this.gridmenu, "keydown");
  7122. this.removeHandler(this.gridmenu, "closed");
  7123. this.removeHandler(this.gridmenu, "itemclick");
  7124. this.gridmenu.jqxMenu("destroy");
  7125. this.gridmenu = null;
  7126. }
  7127. }
  7128. if (this.pagershowrowscombo) {
  7129. this.pagershowrowscombo.jqxDropDownList("destroy");
  7130. this.pagershowrowscombo = null;
  7131. }
  7132. if (this.pagerrightbutton) {
  7133. this.removeHandler(this.pagerrightbutton, "mousedown");
  7134. this.removeHandler(this.pagerrightbutton, "mouseup");
  7135. this.removeHandler(this.pagerrightbutton, "click");
  7136. this.pagerrightbutton.jqxButton("destroy");
  7137. this.pagerrightbutton = null;
  7138. }
  7139. if (this.pagerleftbutton) {
  7140. this.removeHandler(this.pagerleftbutton, "mousedown");
  7141. this.removeHandler(this.pagerleftbutton, "mouseup");
  7142. this.removeHandler(this.pagerleftbutton, "click");
  7143. this.pagerleftbutton.jqxButton("destroy");
  7144. this.removeHandler(b(document), "mouseup.pagerbuttons" + this.element.id);
  7145. this.pagerleftbutton = null;
  7146. }
  7147. this.removeHandler(b(document), "selectstart." + this.element.id);
  7148. this.removeHandler(b(document), "mousedown.resize" + this.element.id);
  7149. this.removeHandler(b(document), "mouseup.resize" + this.element.id);
  7150. this.removeHandler(b(document), "mousemove.resize" + this.element.id);
  7151. if (this.isTouchDevice()) {
  7152. var l = b.jqx.mobile.getTouchEventName("touchmove") + ".resize" + this.element.id;
  7153. var d = b.jqx.mobile.getTouchEventName("touchstart") + ".resize" + this.element.id;
  7154. var g = b.jqx.mobile.getTouchEventName("touchend") + ".resize" + this.element.id;
  7155. this.removeHandler(b(document), l);
  7156. this.removeHandler(b(document), d);
  7157. this.removeHandler(b(document), g);
  7158. }
  7159. this.removeHandler(b(document), "mousedown.reorder" + this.element.id);
  7160. this.removeHandler(b(document), "mouseup.reorder" + this.element.id);
  7161. this.removeHandler(b(document), "mousemove.reorder" + this.element.id);
  7162. if (this.isTouchDevice()) {
  7163. var l = b.jqx.mobile.getTouchEventName("touchmove") + ".reorder" + this.element.id;
  7164. var d = b.jqx.mobile.getTouchEventName("touchstart") + ".reorder" + this.element.id;
  7165. var g = b.jqx.mobile.getTouchEventName("touchend") + ".reorder" + this.element.id;
  7166. this.removeHandler(b(document), l);
  7167. this.removeHandler(b(document), d);
  7168. this.removeHandler(b(document), g);
  7169. }
  7170. this.removeHandler(b(window), "resize." + this.element.id);
  7171. if (this.resizeline) {this.resizeline.remove();}
  7172. if (this.resizestartline) {this.resizestartline.remove();}
  7173. if (this.groupable) {
  7174. var l = "mousemove.grouping" + this.element.id;
  7175. var d = "mousedown.grouping" + this.element.id;
  7176. var g = "mouseup.grouping" + this.element.id;
  7177. this.removeHandler(b(document), l);
  7178. this.removeHandler(b(document), d);
  7179. this.removeHandler(b(document), g);
  7180. }
  7181. if (this.columnsreorder) {
  7182. var l = "mousemove.reorder" + this.element.id;
  7183. var d = "mousedown.reorder" + this.element.id;
  7184. var g = "mouseup.reorder" + this.element.id;
  7185. this.removeHandler(b(document), l);
  7186. this.removeHandler(b(document), d);
  7187. this.removeHandler(b(document), g);
  7188. delete this.columnsbounds;
  7189. }
  7190. if (this.content) {
  7191. this.removeHandler(this.content, "mousedown");
  7192. this.removeHandler(this.content, "scroll");
  7193. }
  7194. this._removeHandlers();
  7195. this.hScrollInstance.destroy();
  7196. this.vScrollInstance.destroy();
  7197. this.hScrollBar.remove();
  7198. this.vScrollBar.remove();
  7199. this._clearcaches();
  7200. delete this.hScrollInstance;
  7201. delete this.vScrollInstance;
  7202. delete this.visiblerows;
  7203. delete this.hittestinfo;
  7204. delete this.rows;
  7205. delete this.columns;
  7206. delete this.columnsbydatafield;
  7207. delete this.pagescache;
  7208. delete this.pageviews;
  7209. delete this.cellscache;
  7210. delete this.heights;
  7211. delete this.hiddens;
  7212. delete this.hiddenboundrows;
  7213. delete this.heightboundrows;
  7214. delete this.detailboundrows;
  7215. delete this.details;
  7216. delete this.expandedgroups;
  7217. delete this._rowdetailscache;
  7218. delete this._rowdetailselementscache;
  7219. delete this.columnsmenu;
  7220. if (this.columnsheader) {
  7221. this.columnsheader.remove();
  7222. delete this.columnsheader;
  7223. }
  7224. if (this.selectionarea) {
  7225. this.selectionarea.remove();
  7226. delete this.selectionarea;
  7227. }
  7228. if (this.menuitemsarray && this.menuitemsarray.length) {
  7229. var o = this.menuitemsarray.length;
  7230. for (var k = 0; k < o; k++) {b(this.menuitemsarray[k]).remove();}
  7231. }
  7232. delete this.menuitemsarray;
  7233. this.dataview._clearcaches();
  7234. this.content.removeClass();
  7235. this.content.remove();
  7236. this.content = null;
  7237. delete this.content;
  7238. this.vScrollBar = null;
  7239. this.hScrollBar = null;
  7240. delete this.hScrollBar;
  7241. delete this.hScrollBar;
  7242. if (this.gridcontent) {
  7243. this.gridcontent.remove();
  7244. delete this.gridcontent;
  7245. }
  7246. if (this.gridmenu) {
  7247. this.gridmenu = null;
  7248. delete this.gridmenu;
  7249. }
  7250. delete this._mousemovefunc;
  7251. delete this._mousewheelfunc;
  7252. this.dataview.destroy();
  7253. delete this.dataview;
  7254. this.bottomRight.remove();
  7255. delete this.bottomRight;
  7256. this.wrapper.remove();
  7257. delete this.wrapper;
  7258. if (this.pagerdiv) {
  7259. this.pagerdiv.remove();
  7260. delete this.pagerdiv;
  7261. }
  7262. if (this.pagerpageinput) {
  7263. this.pagerpageinput.remove();
  7264. delete this.pagerpageinput;
  7265. }
  7266. if (this.pagergoto) {
  7267. this.pagergoto.remove();
  7268. delete this.pagergoto;
  7269. }
  7270. if (this.pagershowrows) {
  7271. this.pagershowrows.remove();
  7272. delete this.pagershowrows;
  7273. }
  7274. if (this.pagerfirstbutton) {
  7275. this.pagerfirstbutton.remove();
  7276. delete this.pagerfirstbutton;
  7277. }
  7278. if (this.pagerlastbutton) {
  7279. this.pagerlastbutton.remove();
  7280. delete this.pagerlastbutton;
  7281. }
  7282. if (this.pagerbuttons) {
  7283. this.pagerbuttons.remove();
  7284. delete this.pagerbuttons;
  7285. }
  7286. if (this.pagerdetails) {
  7287. this.pagerdetails.remove();
  7288. delete this.pagerdetails;
  7289. }
  7290. if (this.pagergotoinput) {
  7291. this.pagergotoinput.remove();
  7292. delete this.pagergotoinput;
  7293. }
  7294. this.pager.remove();
  7295. delete this.pager;
  7296. this.groupsheader.remove();
  7297. delete this.groupsheader;
  7298. this.dataloadelement.remove();
  7299. delete this.dataloadelement;
  7300. this.toolbar.remove();
  7301. delete this.toolbar;
  7302. this.statusbar.remove();
  7303. delete this.statusbar;
  7304. this.host.removeData();
  7305. this.host.removeClass();
  7306. this.host.remove();
  7307. this.host = null;
  7308. delete this.host;
  7309. delete this.element;
  7310. delete this.set;
  7311. delete this.get;
  7312. delete this.that;
  7313. delete this.call;
  7314. },
  7315. _initializeColumns: function () {
  7316. var f = this.source ? this.source.datafields : null;
  7317. if (f == null && this.source && this.source._source) {f = this.source._source.datafields;}
  7318. var k = f ? f.length > 0 : false;
  7319. if (this.autogeneratecolumns) {
  7320. var m = new Array();
  7321. if (f) {
  7322. b.each(f, function () {
  7323. var i = { datafield: this.name, text: this.text || this.name, cellsformat: this.format || "" };
  7324. m.push(i);
  7325. });
  7326. } else {
  7327. if (this.source.records.length > 0) {
  7328. var o = this.source.records[0];
  7329. for (var h in o) {
  7330. if (h != "uid") {
  7331. var g = { width: 100, datafield: h, text: h };
  7332. m.push(g);
  7333. }
  7334. }
  7335. }
  7336. }
  7337. this.columns = m;
  7338. }
  7339. if (this.columns && this.columns.records) {for (var j = 0; j < this.columns.records.length; j++) {this._removecolumnhandlers(this.columns.records[j]);}}
  7340. var l = this.that;
  7341. var e = new b.jqx.collection(this.element);
  7342. var d = 0;
  7343. this._haspinned = false;
  7344. if (!this._columns) {this._columns = this.columns;} else {this.columns = this._columns;}
  7345. if (this.groupable) {
  7346. b.each(this.groups, function (i) {
  7347. var p = new c(l, this);
  7348. p.visibleindex = d++;
  7349. p.width = l.groupindentwidth;
  7350. e.add(p);
  7351. p.grouped = true;
  7352. p.filterable = false;
  7353. p.sortable = false;
  7354. p.editable = false;
  7355. p.resizable = false;
  7356. p.draggable = false;
  7357. });
  7358. }
  7359. if (this.rowdetails && this.showrowdetailscolumn) {
  7360. var g = new c(l, this);
  7361. g.visibleindex = d++;
  7362. g.width = l.groupindentwidth;
  7363. g.pinned = true;
  7364. g.editable = false;
  7365. g.filterable = false;
  7366. g.draggable = false;
  7367. g.groupable = false;
  7368. g.resizable = false;
  7369. e.add(g);
  7370. l._haspinned = true;
  7371. }
  7372. if (this.selectionmode == "checkbox") {
  7373. var g = new c(l, null);
  7374. g.visibleindex = d++;
  7375. g.width = l.groupindentwidth;
  7376. g.checkboxcolumn = true;
  7377. g.editable = false;
  7378. g.columntype = "checkbox";
  7379. g.groupable = false;
  7380. g.draggable = false;
  7381. g.filterable = false;
  7382. g.resizable = false;
  7383. g.datafield = "_checkboxcolumn";
  7384. e.add(g);
  7385. }
  7386. var n = new Array();
  7387. b.each(this.columns, function (i) {
  7388. if (l.columns[i] != undefined) {
  7389. var p = new c(l, this);
  7390. p.visibleindex = d++;
  7391. if (this.dataField != undefined) {this.datafield = this.dataField;}
  7392. if (this.pinned) {l._haspinned = true;}
  7393. if (l.showeverpresentrow) {
  7394. if (this.datafield === "addButtonColumn" || this.datafield === "resetButtonColumn" || this.datafield === "updateButtonColumn" || this.datafield === "deleteButtonColumn") {
  7395. p.editable = false;
  7396. p.groupable = false;
  7397. p.draggable = false;
  7398. p.filterable = false;
  7399. p.resizable = false;
  7400. p.menu = false;
  7401. }
  7402. }
  7403. if (this.datafield == null) {
  7404. if (l.source && l.source._source && (l.source._source.datatype == "array")) {
  7405. if (!k) {
  7406. if (!l.source._source.datafields) {
  7407. l.source._source.datafields = new Array();
  7408. l.source._source.datafields.push({ name: i.toString() });
  7409. } else {l.source._source.datafields.push({ name: i.toString() });}
  7410. }
  7411. this.datafield = i.toString();
  7412. this.displayfield = i.toString();
  7413. p.datafield = this.datafield;
  7414. p.displayfield = this.displayfield;
  7415. }
  7416. } else {
  7417. if (n[this.datafield]) {
  7418. throw new Error("jqxGrid: Invalid column 'datafield' setting. jqxGrid's columns should be initialized with unique data fields.");
  7419. l.host.remove();
  7420. return false;
  7421. } else {n[this.datafield] = true;}
  7422. }
  7423. e.add(p);
  7424. }
  7425. });
  7426. if (this.adaptive) {
  7427. var g = new c(l, null);
  7428. g.visibleindex = d++;
  7429. g.width = l.groupindentwidth;
  7430. g.editable = false;
  7431. g.columntype = "adaptive";
  7432. g.cellsalign = "center";
  7433. g.groupable = false;
  7434. g.draggable = false;
  7435. g.menu = false;
  7436. g.sortable = false;
  7437. g.filterable = false;
  7438. g.resizable = false;
  7439. g.datafield = "_adaptivecolumn";
  7440. e.add(g);
  7441. }
  7442. if (this.rtl) {e.records.reverse();}
  7443. this.columns = e;
  7444. },
  7445. _initializeRows: function () {
  7446. var d = new b.jqx.collection(this.element);
  7447. if (this.rows) {this.rows.clear();}
  7448. this.rows = d;
  7449. },
  7450. _raiseEvent: function (j, e) {
  7451. if (e == undefined) {e = { owner: null };}
  7452. if (this._trigger === false) {return;}
  7453. var f = this.events[j];
  7454. if (!this._camelCase) {f = f.toLowerCase();}
  7455. if (j == 2 || j == 15) {
  7456. if (this.showeverpresentrow && (this.everpresentrowactions.indexOf("delete") >= 0 || this.everpresentrowactions.indexOf("update") >= 0)) {
  7457. if (this.updateeverpresentrow) {var i = this;}
  7458. setTimeout(function () {i.updateeverpresentrow();}, 50);
  7459. }
  7460. }
  7461. var g = e;
  7462. g.owner = this;
  7463. var h = new b.Event(f);
  7464. h.owner = this;
  7465. h.args = g;
  7466. var d = this.host.trigger(h);
  7467. e = h.args;
  7468. return d;
  7469. },
  7470. wheel: function (f, e) {
  7471. if (e.autoheight && e.hScrollBar.css("visibility") != "visible") {
  7472. f.returnValue = true;
  7473. return true;
  7474. }
  7475. var g = 0;
  7476. if (!f) {f = window.event;}
  7477. if (f.originalEvent && f.originalEvent.wheelDelta) {f.wheelDelta = f.originalEvent.wheelDelta;}
  7478. if (f.wheelDelta) {g = f.wheelDelta / 120;} else {if (f.detail) {g = -f.detail / 3;}}
  7479. if (g) {
  7480. var d = e._handleDelta(g);
  7481. if (d) {
  7482. if (f.preventDefault) {f.preventDefault();}
  7483. if (f.originalEvent != null) {f.originalEvent.mouseHandled = true;}
  7484. if (f.stopPropagation != undefined) {f.stopPropagation();}
  7485. }
  7486. if (d) {
  7487. d = false;
  7488. f.returnValue = d;
  7489. return d;
  7490. } else {return false;}
  7491. }
  7492. if (f.preventDefault) {f.preventDefault();}
  7493. f.returnValue = false;
  7494. },
  7495. _handleDelta: function (f) {
  7496. if (this.vScrollBar.css("visibility") != "hidden") {
  7497. var e = this.vScrollInstance.value;
  7498. if (f < 0) {this.scrollDown();} else {this.scrollUp();}
  7499. var d = this.vScrollInstance.value;
  7500. if (e != d) {return true;}
  7501. } else {
  7502. if (this.hScrollBar.css("visibility") != "hidden") {
  7503. var e = this.hScrollInstance.value;
  7504. if (f > 0) {if (this.hScrollInstance.value > 2 * this.horizontalscrollbarstep) {this.hScrollInstance.setPosition(this.hScrollInstance.value - 2 * this.horizontalscrollbarstep);} else {this.hScrollInstance.setPosition(0);}} else {if (this.hScrollInstance.value < this.hScrollInstance.max) {this.hScrollInstance.setPosition(this.hScrollInstance.value + 2 * this.horizontalscrollbarstep);} else {this.hScrollInstance.setPosition(this.hScrollInstance.max);}}
  7505. var d = this.hScrollInstance.value;
  7506. if (e != d) {return true;}
  7507. }
  7508. }
  7509. return false;
  7510. },
  7511. scrollDown: function () {
  7512. if (this.vScrollBar.css("visibility") == "hidden") {return;}
  7513. var d = this.vScrollInstance;
  7514. if (d.value + this.rowsheight <= d.max) {d.setPosition(parseInt(d.value) + this.rowsheight);} else {d.setPosition(d.max);}
  7515. },
  7516. scrollUp: function () {
  7517. if (this.vScrollBar.css("visibility") == "hidden") {return;}
  7518. var d = this.vScrollInstance;
  7519. if (d.value - this.rowsheight >= d.min) {d.setPosition(parseInt(d.value) - this.rowsheight);} else {d.setPosition(d.min);}
  7520. },
  7521. _removeHandlers: function () {
  7522. var d = this.that;
  7523. d.removeHandler(b(window), "orientationchange.jqxgrid" + d.element.id);
  7524. d.removeHandler(b(window), "orientationchanged.jqxgrid" + d.element.id);
  7525. d.removeHandler(d.vScrollBar, "valueChanged");
  7526. d.removeHandler(d.hScrollBar, "valueChanged");
  7527. d.vScrollInstance.valueChanged = null;
  7528. d.hScrollInstance.valueChanged = null;
  7529. var e = "mousedown.jqxgrid";
  7530. if (d.isTouchDevice()) {e = b.jqx.mobile.getTouchEventName("touchend");}
  7531. d.removeHandler(d.host, "dblclick.jqxgrid");
  7532. d.removeHandler(d.host, e);
  7533. d.removeHandler(d.content, "mousemove", d._mousemovefunc);
  7534. d.removeHandler(d.host, "mouseleave.jqxgrid");
  7535. d.removeHandler(d.content, "mouseenter");
  7536. d.removeHandler(d.content, "mouseleave");
  7537. d.removeHandler(d.content, "mousedown");
  7538. d.removeHandler(d.content, "scroll");
  7539. d.removeHandler(d.content, "selectstart." + d.element.id);
  7540. d.removeHandler(d.host, "dragstart." + d.element.id);
  7541. d.removeHandler(d.host, "keydown.edit" + d.element.id);
  7542. d.removeHandler(b(document), "keydown.edit" + d.element.id);
  7543. d.removeHandler(b(document), "keyup.edit" + d.element.id);
  7544. if (d._mousemovedocumentfunc) {d.removeHandler(b(document), "mousemove.selection" + d.element.id, d._mousemovedocumentfunc);}
  7545. d.removeHandler(b(document), "mouseup.selection" + d.element.id);
  7546. if (d._mousewheelfunc) {d.removeHandler(d.host, "mousewheel", d._mousewheelfunc);}
  7547. if (d.editable) {d.removeHandler(b(document), "mousedown.gridedit" + d.element.id);}
  7548. if (d.host.off) {
  7549. d.content.off("mousemove");
  7550. d.host.off("mousewheel");
  7551. }
  7552. },
  7553. _addHandlers: function () {
  7554. var e = this.that;
  7555. var d = e.isTouchDevice();
  7556. if (!d) {e.addHandler(e.host, "dragstart." + e.element.id, function (j) {return false;});}
  7557. if (e.scrollbarautoshow) {
  7558. e.addHandler(e.host, "mouseenter.gridscroll" + e.element.id, function (j) {
  7559. e.vScrollBar.fadeIn("fast");
  7560. e.hScrollBar.fadeIn("fast");
  7561. });
  7562. e.addHandler(e.host, "mouseleave.gridscroll" + e.element.id, function (j) {
  7563. if (!e.vScrollInstance.isScrolling() && !e.hScrollInstance.isScrolling()) {
  7564. e.vScrollBar.fadeOut("fast");
  7565. e.hScrollBar.fadeOut("fast");
  7566. }
  7567. });
  7568. }
  7569. if (e.editable) {
  7570. e.addHandler(b(document), "mousedown.gridedit" + e.element.id, function (m) {
  7571. if (e.editable && e.begincelledit) {
  7572. if (e.editcell) {
  7573. if (!e.vScrollInstance.isScrolling() && !e.vScrollInstance.isScrolling()) {
  7574. var r = e.host.coord();
  7575. var q = e.host.width();
  7576. var n = e.host.height();
  7577. var v = false;
  7578. var k = false;
  7579. var t = false;
  7580. if (m.pageY < r.top || m.pageY > r.top + n) {
  7581. v = true;
  7582. k = true;
  7583. }
  7584. if (m.pageX < r.left || m.pageX > r.left + q) {
  7585. v = true;
  7586. t = true;
  7587. }
  7588. if (v) {
  7589. var u = false;
  7590. if (e.editcell && e.editcell.editor) {
  7591. switch (e.editcell.columntype) {
  7592. case"datetimeinput":
  7593. if (e.editcell.editor.jqxDateTimeInput && e.editcell.editor.jqxDateTimeInput("container") && e.editcell.editor.jqxDateTimeInput("container")[0].style.display == "block") {
  7594. var s = e.editcell.editor.jqxDateTimeInput("container").coord().top;
  7595. var j = e.editcell.editor.jqxDateTimeInput("container").coord().top + e.editcell.editor.jqxDateTimeInput("container").height();
  7596. if (k && (m.pageY < s || m.pageY > j)) {
  7597. v = true;
  7598. e.editcell.editor.jqxDateTimeInput("close");
  7599. } else {return;}
  7600. }
  7601. break;
  7602. case"combobox":
  7603. if (e.editcell.editor.jqxComboBox && e.editcell.editor.jqxComboBox("container") && e.editcell.editor.jqxComboBox("container")[0].style.display == "block") {
  7604. var s = e.editcell.editor.jqxComboBox("container").coord().top;
  7605. var j = e.editcell.editor.jqxComboBox("container").coord().top + e.editcell.editor.jqxComboBox("container").height();
  7606. if (k && (m.pageY < s || m.pageY > j)) {
  7607. v = true;
  7608. e.editcell.editor.jqxComboBox("close");
  7609. } else {return;}
  7610. }
  7611. break;
  7612. case"dropdownlist":
  7613. if (e.editcell.editor.jqxDropDownList && e.editcell.editor.jqxDropDownList("container") && e.editcell.editor.jqxDropDownList("container")[0].style.display == "block") {
  7614. var s = e.editcell.editor.jqxDropDownList("container").coord().top;
  7615. var j = e.editcell.editor.jqxDropDownList("container").coord().top + e.editcell.editor.jqxDropDownList("container").height();
  7616. if (k && (m.pageY < s || m.pageY > j)) {
  7617. v = true;
  7618. e.editcell.editor.jqxDropDownList("close");
  7619. } else {return;}
  7620. }
  7621. break;
  7622. case"template":
  7623. case"custom":
  7624. var l = ["jqxDropDownList", "jqxComboBox", "jqxDropDownButton", "jqxDateTimeInput"];
  7625. var p = function (A) {
  7626. var z = e.editcell.editor.data();
  7627. if (z[A] && z[A].instance.container && z[A].instance.container[0].style.display == "block") {
  7628. var x = z[A].instance;
  7629. var B = x.container.coord().top;
  7630. var y = x.container.coord().top + x.container.height();
  7631. if (k && (m.pageY < B || m.pageY > y)) {
  7632. v = true;
  7633. x.close();
  7634. return true;
  7635. } else {return false;}
  7636. }
  7637. };
  7638. for (var o = 0; o < l.length; o++) {
  7639. var w = p(l[o]);
  7640. if (w == false) {return;}
  7641. }
  7642. break;
  7643. }
  7644. }
  7645. e.endcelledit(e.editcell.row, e.editcell.column, false, true);
  7646. e._oldselectedcell = null;
  7647. }
  7648. }
  7649. }
  7650. }
  7651. });
  7652. }
  7653. e.vScrollInstance.valueChanged = function (j) {
  7654. if (e.virtualsizeinfo) {
  7655. e._closemenu();
  7656. if (e.scrollmode != "physical") {
  7657. e._renderrows(e.virtualsizeinfo);
  7658. e.currentScrollValue = j.currentValue;
  7659. } else {
  7660. if (e.currentScrollValue != undefined && Math.abs(e.currentScrollValue - j.currentValue) >= 5) {
  7661. e._renderrows(e.virtualsizeinfo);
  7662. e.currentScrollValue = j.currentValue;
  7663. } else {
  7664. e._renderrows(e.virtualsizeinfo);
  7665. e.currentScrollValue = j.currentValue;
  7666. }
  7667. }
  7668. if (!e.pageable && !e.groupable && e.dataview.virtualmode) {
  7669. if (e.loadondemandupdate) {clearTimeout(e.loadondemandupdate);}
  7670. e.loadondemandupdate = setTimeout(function () {
  7671. e.loadondemand = true;
  7672. e._renderrows(e.virtualsizeinfo);
  7673. }, 100);
  7674. }
  7675. if (d) {e._lastScroll = new Date();}
  7676. }
  7677. };
  7678. e.hScrollInstance.valueChanged = function (l) {
  7679. if (e.virtualsizeinfo) {
  7680. e._closemenu();
  7681. var k = function () {
  7682. e._renderhorizontalscroll();
  7683. e._renderrows(e.virtualsizeinfo);
  7684. if (e.editcell && !e.editrow) {if (e._showcelleditor && e.editcell.editing) {if (!e.hScrollInstance.isScrolling()) {e._showcelleditor(e.editcell.row, e.getcolumn(e.editcell.column), e.editcell.element, e.editcell.init);}}}
  7685. };
  7686. if (d) {k();} else {
  7687. var j = e._browser == undefined ? e._isIE10() : e._browser;
  7688. if (navigator && navigator.userAgent.indexOf("Safari") != -1 && navigator.userAgent.indexOf("Chrome") == -1) {
  7689. if (e._hScrollTimer) {clearTimeout(e._hScrollTimer);}
  7690. e._hScrollTimer = setTimeout(function () {k();}, 1);
  7691. } else {
  7692. if (b.jqx.browser.msie) {
  7693. if (e._hScrollTimer) {clearTimeout(e._hScrollTimer);}
  7694. e._hScrollTimer = setTimeout(function () {k();}, 0.01);
  7695. } else {k();}
  7696. }
  7697. }
  7698. if (d) {e._lastScroll = new Date();}
  7699. }
  7700. };
  7701. e._mousewheelfunc = e._mousewheelfunc || function (j) {
  7702. if (!e.editcell && e.enablemousewheel) {
  7703. e.wheel(j, e);
  7704. return false;
  7705. }
  7706. };
  7707. e.removeHandler(e.host, "mousewheel", e._mousewheelfunc);
  7708. e.addHandler(e.host, "mousewheel", e._mousewheelfunc);
  7709. var h = "mousedown.jqxgrid";
  7710. if (d) {h = b.jqx.mobile.getTouchEventName("touchend");}
  7711. e.addHandler(e.host, h, function (k) {
  7712. if (e.isTouchDevice()) {
  7713. e._newScroll = new Date();
  7714. if (e._newScroll - e._lastScroll < 500) {return false;}
  7715. if (b(k.target).ischildof(e.vScrollBar)) {return false;}
  7716. if (b(k.target).ischildof(e.hScrollBar)) {return false;}
  7717. }
  7718. e._mousedown = new Date();
  7719. var j = e._handlemousedown(k, e);
  7720. if (e.isNestedGrid) {if (!e.resizablecolumn && !e.columnsreorder) {k.stopPropagation();}}
  7721. e._lastmousedown = new Date();
  7722. return j;
  7723. });
  7724. if (!d) {
  7725. e.addHandler(e.host, "dblclick.jqxgrid", function (k) {
  7726. if (e.editable && e.begincelledit && e.editmode == "dblclick") {e._handledblclick(k, e);} else {if (b.jqx.browser.msie && b.jqx.browser.version < 9) {var j = e._handlemousedown(k, e);}}
  7727. e.mousecaptured = false;
  7728. e._lastmousedown = new Date();
  7729. return true;
  7730. });
  7731. e._mousemovefunc = function (j) {if (e._handlemousemove) {return e._handlemousemove(j, e);}};
  7732. e.addHandler(e.content, "mousemove", e._mousemovefunc);
  7733. if (e._handlemousemoveselection) {
  7734. e._mousemovedocumentfunc = function (j) {if (e._handlemousemoveselection) {return e._handlemousemoveselection(j, e);}};
  7735. e.addHandler(b(document), "mousemove.selection" + e.element.id, e._mousemovedocumentfunc);
  7736. }
  7737. e.addHandler(b(document), "mouseup.selection" + e.element.id, function (j) {if (e._handlemouseupselection) {e._handlemouseupselection(j, e);}});
  7738. }
  7739. try {
  7740. if (document.referrer != "" || window.frameElement) {
  7741. if (window.top != null && window.top != window.self) {
  7742. var i = null;
  7743. if (window.parent && document.referrer) {i = document.referrer;}
  7744. if (i && i.indexOf(document.location.host) != -1) {
  7745. var g = function (k) {if (e._handlemouseupselection) {try {e._handlemouseupselection(k, e);} catch (j) {}}};
  7746. e.addHandler(b(window.top.document), "mouseup.grid" + e.element.id, g);
  7747. }
  7748. }
  7749. }
  7750. } catch (f) {}
  7751. e.focused = false;
  7752. if (!d) {
  7753. e.addHandler(e.content, "mouseenter", function (j) {
  7754. e.focused = true;
  7755. if (e.wrapper) {
  7756. e.wrapper.attr("tabindex", 1);
  7757. e.content.attr("tabindex", 2);
  7758. }
  7759. if (e._overlayElement) {if (e.vScrollInstance.isScrolling() || e.hScrollInstance.isScrolling()) {e._overlayElement[0].style.visibility = "visible";} else {e._overlayElement[0].style.visibility = "hidden";}}
  7760. });
  7761. e.addHandler(e.content, "mouseleave", function (j) {
  7762. if (e._handlemousemove) {if (e.enablehover) {e._clearhoverstyle();}}
  7763. if (e._overlayElement) {e._overlayElement[0].style.visibility = "hidden";}
  7764. e.focused = false;
  7765. });
  7766. if (e.groupable || e.columnsreorder) {e.addHandler(b(document), "selectstart." + e.element.id, function (j) {if (e.__drag === true) {return false;}});}
  7767. e.addHandler(e.content, "selectstart." + e.element.id, function (j) {
  7768. if (e.enablebrowserselection) {return true;}
  7769. if (e.showfilterrow) {if (b(j.target).ischildof(e.filterrow)) {return true;}}
  7770. if (e.showeverpresentrow) {
  7771. if (b(j.target).ischildof(e.addnewrow)) {return true;}
  7772. if (e.addnewrowtop) {if (b(j.target).ischildof(e.addnewrowtop)) {return true;}}
  7773. }
  7774. if (j.target.className && j.target.className.indexOf("jqx-grid-widget") >= 0) {return true;}
  7775. if (!e.editcell) {return false;}
  7776. if (j.stopPropagation) {j.stopPropagation();}
  7777. });
  7778. e.addHandler(b(document), "keyup.edit" + e.element.id, function (j) {e._keydown = false;});
  7779. e.addHandler(b(document), "keydown.edit" + e.element.id, function (l) {
  7780. if (e.adaptiveview) {return true;}
  7781. e._keydown = true && !e.editcell;
  7782. var k = l.charCode ? l.charCode : l.keyCode ? l.keyCode : 0;
  7783. if (k === 20) {if (!e._capsLock) {e._capsLock = true;} else {e._capsLock = false;}}
  7784. if (e.handlekeyboardnavigation) {
  7785. if (e.focused || (l.target === e.element || b(l.target).ischildof(e.host))) {
  7786. var m = e.handlekeyboardnavigation(l);
  7787. if (m == true) {return false;}
  7788. }
  7789. }
  7790. if (e.editable && e.editcell) {if (k == 13 || k == 27 || k == 9 || k == 32) {if (e._handleeditkeydown) {j = e._handleeditkeydown(l, e);}}}
  7791. if (k == 27) {
  7792. e.mousecaptured = false;
  7793. if (e.selectionarea.css("visibility") == "visible") {e.selectionarea.css("visibility", "hidden");}
  7794. }
  7795. if (b.jqx.browser.msie && b.jqx.browser.version < 12 && e.focused && !e.isNestedGrid) {
  7796. if (k == 13 && j == false) {return j;}
  7797. var j = true;
  7798. var k = l.charCode ? l.charCode : l.keyCode ? l.keyCode : 0;
  7799. if (!e.editcell && e.editable && e.editmode != "programmatic") {if (e._handleeditkeydown) {j = e._handleeditkeydown(l, e);}}
  7800. if (j && e.keyboardnavigation && e._handlekeydown) {
  7801. j = e._handlekeydown(l, e);
  7802. if (!j) {
  7803. if (l.preventDefault) {l.preventDefault();}
  7804. if (l.stopPropagation != undefined) {l.stopPropagation();}
  7805. }
  7806. return j;
  7807. }
  7808. }
  7809. return true;
  7810. });
  7811. e.addHandler(e.host, "keyup.edit" + e.element.id, function (k) {
  7812. if (e.adaptiveview) {return true;}
  7813. if (k.keyCode === 9) {
  7814. if (!b(document.activeElement).ischildof(e.filterrow)) {
  7815. if (!b(document.activeElement).ischildof(e.pager)) {
  7816. switch (e.selectionmode) {
  7817. case"singlecell":
  7818. case"multiplecells":
  7819. case"multiplecellsextended":
  7820. case"multiplecellsadvanced":
  7821. var j = e.getselectedcell();
  7822. if (j === null) {e.selectcell(0, e.columns.records[0].displayfield);}
  7823. break;
  7824. default:
  7825. var l = e.getselectedrowindex();
  7826. if (l === -1) {e.selectrow(0);}
  7827. break;
  7828. }
  7829. }
  7830. }
  7831. }
  7832. });
  7833. e.addHandler(e.host, "keydown.edit" + e.element.id, function (l) {
  7834. var j = true;
  7835. if (e.adaptiveview) {return true;}
  7836. if (e.handlekeyboardnavigation) {
  7837. var m = e.handlekeyboardnavigation(l);
  7838. if (m == true) {return false;}
  7839. }
  7840. if (e.editable && e.editmode != "programmatic") {
  7841. if (e._handleeditkeydown) {
  7842. j = e._handleeditkeydown(l, e);
  7843. if (e.isNestedGrid) {l.stopPropagation();}
  7844. }
  7845. }
  7846. if (!e.editcell && l.altKey) {
  7847. if (!b(document.activeElement).ischildof(e.filterrow)) {
  7848. if (!b(document.activeElement).ischildof(e.pager)) {
  7849. if (l.keyCode === 40) {
  7850. var k = e.getselectedcell();
  7851. if (k) {e.openmenu(k.column);}
  7852. } else {if (l.keyCode === 38) {e._closemenu();}}
  7853. }
  7854. }
  7855. }
  7856. if (!(b.jqx.browser.msie && b.jqx.browser.version < 8)) {
  7857. if (j && e.keyboardnavigation && e._handlekeydown) {
  7858. j = e._handlekeydown(l, e);
  7859. if (e.isNestedGrid) {l.stopPropagation();}
  7860. }
  7861. } else {
  7862. if (e.isNestedGrid) {
  7863. if (j && e.keyboardnavigation && e._handlekeydown) {
  7864. j = e._handlekeydown(l, e);
  7865. l.stopPropagation();
  7866. }
  7867. }
  7868. }
  7869. if (!j) {
  7870. if (l.preventDefault) {l.preventDefault();}
  7871. if (l.stopPropagation != undefined) {l.stopPropagation();}
  7872. }
  7873. if (j && e.selectedcells && e.selectedcells.length > 0) {if (l.keyCode === 9 && l.shiftKey && e.table && e.table[0].rows && e.table[0].rows.length > 0) {if (!b(document.activeElement).ischildof(e.filterrow)) {if (!b(document.activeElement).ischildof(e.pager)) {e.table[0].rows[0].cells[0].focus();}}}}
  7874. return j;
  7875. });
  7876. }
  7877. },
  7878. _hittestrow: function (s, q) {
  7879. if (this.vScrollInstance == null || this.hScrollInstance == null) {return;}
  7880. if (s == undefined) {s = 0;}
  7881. if (q == undefined) {q == 0;}
  7882. var l = this.vScrollInstance;
  7883. var k = this.hScrollInstance;
  7884. var f = l.value;
  7885. if (this.vScrollBar.css("visibility") != "visible") {f = 0;}
  7886. var m = k.value;
  7887. if (this.hScrollBar.css("visibility") != "visible") {m = 0;}
  7888. if (this.scrollmode == "deferred" && this._newmax != null) {if (f > this._newmax) {f = this._newmax;}}
  7889. var r = parseInt(f) + q;
  7890. var j = parseInt(m) + s;
  7891. if (this.visiblerows == null) {return;}
  7892. if (this.visiblerows.length == 0) {return;}
  7893. var e = false;
  7894. var i = this._findvisiblerow(r, this.visiblerows);
  7895. if (i >= 0) {
  7896. var o = this.visiblerows[i];
  7897. var d = this.rowdetails && o.rowdetails;
  7898. var n = !o.rowdetailshidden;
  7899. if (d) {
  7900. var g = this.visiblerows[i - 1];
  7901. if (g == o) {
  7902. o = g;
  7903. i--;
  7904. }
  7905. if (n) {
  7906. var h = b(this.hittestinfo[i].visualrow).position().top + parseInt(this.table.css("top"));
  7907. var p = b(this.hittestinfo[i].visualrow).height();
  7908. if (!(q >= h && q <= h + p)) {
  7909. i++;
  7910. o = this.visiblerows[i];
  7911. e = true;
  7912. }
  7913. }
  7914. }
  7915. }
  7916. return { index: i, row: o, details: e };
  7917. },
  7918. getcellatposition: function (j, q) {
  7919. var r = this.that;
  7920. var z = this.showheader ? this.columnsheader.height() + 2 : 0;
  7921. var s = this._groupsheader() ? this.groupsheader.height() : 0;
  7922. var B = this.showtoolbar ? this.toolbarheight : 0;
  7923. s += B;
  7924. var g = this.host.coord();
  7925. if (this.hasTransform) {g = b.jqx.utilities.getOffset(this.host);}
  7926. var p = j - g.left;
  7927. var n = q - z - g.top - s;
  7928. var d = this._hittestrow(p, n);
  7929. var k = d.row;
  7930. var l = d.index;
  7931. var t = this.table[0].rows[l];
  7932. if (this.dataview && this.dataview.records.length == 0) {
  7933. var o = this.table[0].rows;
  7934. var C = 0;
  7935. for (var w = 0; w < o.length; w++) {
  7936. if (n >= C && n < C + this.rowsheight) {
  7937. t = o[w];
  7938. break;
  7939. }
  7940. C += this.rowsheight;
  7941. }
  7942. k = { boundindex: w };
  7943. }
  7944. if (t == null) {return true;}
  7945. var u = this.hScrollInstance;
  7946. var v = u.value;
  7947. var f = 0;
  7948. var m = this.groupable ? this.groups.length : 0;
  7949. for (var w = 0; w < t.cells.length; w++) {
  7950. var h = parseInt(b(this.columnsrow[0].cells[w]).css("left"));
  7951. var j = h - v;
  7952. if (r.columns.records[w].pinned) {j = h;}
  7953. if (r.columns.records[w].hidden || r.columns.records[w].adaptivehidden) {continue;}
  7954. var A = j + b(this.columnsrow[0].cells[w]).width();
  7955. if (A >= p && p >= j) {
  7956. f = w;
  7957. break;
  7958. }
  7959. }
  7960. if (k != null) {
  7961. var e = this._getcolumnat(f);
  7962. return { row: this.getboundindex(k), column: e.datafield, value: this.getcellvalue(this.getboundindex(k), e.datafield) };
  7963. }
  7964. return null;
  7965. },
  7966. _handlemousedown: function (Y, n) {
  7967. if (Y.target == null) {return true;}
  7968. if (n.disabled) {return true;}
  7969. if (b(Y.target).ischildof(this.columnsheader) || b(Y.target).ischildof(this.hScrollBar) || b(Y.target).ischildof(this.vScrollBar)) {return true;}
  7970. if (Y.target === n.bottomRight[0]) {return true;}
  7971. var o;
  7972. if (Y.which) {o = (Y.which == 3);} else {if (Y.button) {o = (Y.button == 2);}}
  7973. var R;
  7974. if (Y.which) {R = (Y.which == 2);} else {if (Y.button) {R = (Y.button == 1);}}
  7975. if (R) {return true;}
  7976. if (this.adaptiveview) {
  7977. if (b(Y.target).ischildof(b(this.adaptiveview))) {return true;}
  7978. if (Y.target == this.adaptiveview) {return true;}
  7979. }
  7980. if (this.showstatusbar) {
  7981. if (b(Y.target).ischildof(this.statusbar)) {return true;}
  7982. if (Y.target == this.statusbar[0]) {return true;}
  7983. }
  7984. if (this.showtoolbar) {
  7985. if (b(Y.target).ischildof(this.toolbar)) {return true;}
  7986. if (Y.target == this.toolbar[0]) {return true;}
  7987. }
  7988. if (this.pageable) {
  7989. if (b(Y.target).ischildof(this.pager)) {return true;}
  7990. if (Y.target == this.pager[0]) {return true;}
  7991. }
  7992. if (!this.columnsheader) {return true;}
  7993. if (!this.editcell) {if (this.pageable) {if (b(Y.target).ischildof(this.pager)) {return true;}}}
  7994. var W = this.showheader ? this.columnsheader.height() + 2 : 0;
  7995. var C = this._groupsheader() ? this.groupsheader.height() : 0;
  7996. var F = this.showtoolbar ? this.toolbarheight : 0;
  7997. C += F;
  7998. var U = this.host.coord();
  7999. if (this.hasTransform) {
  8000. U = b.jqx.utilities.getOffset(this.host);
  8001. var ab = this._getBodyOffset();
  8002. U.left -= ab.left;
  8003. U.top -= ab.top;
  8004. }
  8005. var k = parseInt(Y.pageX);
  8006. var l = parseInt(Y.pageY);
  8007. if (this.isTouchDevice()) {
  8008. var Z = n.getTouches(Y);
  8009. var Q = Z[0];
  8010. k = parseInt(Q.pageX);
  8011. l = parseInt(Q.pageY);
  8012. if (n.touchmode == true) {
  8013. if (Q._pageX != undefined) {
  8014. k = parseInt(Q._pageX);
  8015. l = parseInt(Q._pageY);
  8016. }
  8017. }
  8018. }
  8019. var J = k - U.left;
  8020. var I = l - W - U.top - C;
  8021. if (this.pageable && !this.autoheight && this.gotopage) {
  8022. var d = this.pager.coord().top - U.top - C - W;
  8023. if (I > d) {return;}
  8024. }
  8025. var V = this._hittestrow(J, I);
  8026. if (!V) {return;}
  8027. if (V.details) {return;}
  8028. var r = V.row;
  8029. var E = V.index;
  8030. var s = Y.target.className;
  8031. var j = this.table[0].rows[E];
  8032. if (j == null) {
  8033. if (n.editable && n.begincelledit) {if (n.editcell) {n.endcelledit(n.editcell.row, n.editcell.column, false, true);}}
  8034. return true;
  8035. }
  8036. n.mousecaptured = true;
  8037. n.mousecaptureposition = { left: Y.pageX, top: Y.pageY - C, clickedrow: j };
  8038. var m = this.hScrollInstance;
  8039. var u = m.value;
  8040. if (this.rtl) {if (this.hScrollBar.css("visibility") != "hidden") {u = m.max - m.value;}}
  8041. var G = -1;
  8042. var D = this.groupable ? this.groups.length : 0;
  8043. if (this.rtl) {
  8044. if (this.vScrollBar[0].style.visibility != "hidden") {u -= this.scrollbarsize + 4;}
  8045. if (this.hScrollBar[0].style.visibility == "hidden") {u = -parseInt(this.content.css("left"));}
  8046. }
  8047. for (var S = 0; S < j.cells.length; S++) {
  8048. var T = parseInt(b(this.columnsrow[0].cells[S]).css("left"));
  8049. var k = T - u;
  8050. if (n.columns.records[S].pinned && !n.rtl) {k = T;}
  8051. var L = this._getcolumnat(S);
  8052. if (L != null && L.hidden) {continue;}
  8053. if (L != null && L.adaptivehidden) {continue;}
  8054. var N = k + b(this.columnsrow[0].cells[S]).width();
  8055. if (N >= J && J >= k) {
  8056. G = S;
  8057. n.mousecaptureposition.clickedcell = S;
  8058. break;
  8059. }
  8060. }
  8061. if (this.rtl && this._haspinned) {
  8062. for (var S = j.cells.length - 1; S >= 0; S--) {
  8063. if (!n.columns.records[S].pinned) {break;}
  8064. var T = b(this.columnsrow[0].cells[S]).coord().left - this.host.coord().left;
  8065. var k = T;
  8066. var L = this._getcolumnat(S);
  8067. if (L != null && L.hidden) {continue;}
  8068. if (L != null && L.adaptivehidden) {continue;}
  8069. var N = k + b(this.columnsrow[0].cells[S]).width();
  8070. if (N >= J && J >= k) {
  8071. G = S;
  8072. n.mousecaptureposition.clickedcell = S;
  8073. break;
  8074. }
  8075. }
  8076. }
  8077. if (r != null && G >= 0) {
  8078. this._raiseEvent(1, { rowindex: this.getboundindex(r), visibleindex: r.visibleindex, row: r, group: r.group, rightclick: o, originalEvent: Y });
  8079. var L = this._getcolumnat(G);
  8080. var O = this.getcellvalue(this.getboundindex(r), L.datafield);
  8081. if (this.editable && this.editcell) {
  8082. this._currentEditableColumn = G;
  8083. if (L.datafield == this.editcell.column) {if (this.getboundindex(r) == this.editcell.row) {this.mousecaptured = false;}}
  8084. }
  8085. if (L.columntype === "adaptive") {
  8086. var K = document.createElement("div");
  8087. var aa = document.createElement("div");
  8088. var A = document.createElement("a");
  8089. var w = document.createElement("a");
  8090. var f = document.createElement("div");
  8091. var M = this.getrowdata(this.getboundindex(r));
  8092. A.href = "#";
  8093. w.href = "#";
  8094. K.style.zIndex = 99999;
  8095. K.style.position = "absolute";
  8096. K.style.left = "0px";
  8097. K.style.top = "0px";
  8098. K.style.width = "100%";
  8099. K.style.height = "100%";
  8100. K.className = "jqx-adaptive-view jqx-widget-content";
  8101. f.style.position = "relative";
  8102. f.style.top = "100%";
  8103. f.style.textAlign = "center";
  8104. f.style.marginTop = "-40px";
  8105. aa.style.position = "absolute";
  8106. aa.style.left = "0px";
  8107. aa.style.top = "0px";
  8108. aa.style.width = "100%";
  8109. aa.style.height = "100%";
  8110. if (this.theme) {K.className = "jqx-widget-content jqx-widget-content-" + this.theme;}
  8111. var e = document.createElement("span");
  8112. e.className = "jqx-icon-close";
  8113. if (this.theme) {e.className = "jqx-icon-close jqx-widget-close-" + this.theme;}
  8114. e.style.zIndex = 99;
  8115. e.style.position = "absolute";
  8116. e.style.right = "10px";
  8117. e.style.top = "10px";
  8118. e.style.width = "16px";
  8119. e.style.height = "16px";
  8120. K.appendChild(aa);
  8121. K.appendChild(e);
  8122. A.innerHTML = this.gridlocalization.okstring;
  8123. w.innerHTML = this.gridlocalization.cancelstring;
  8124. A.addEventListener("mousedown", function (ad) {
  8125. var af = {};
  8126. var x = n.adaptiveview.querySelectorAll("input");
  8127. for (var y = 0; y < x.length; y++) {
  8128. var ae = x[y].value;
  8129. var ac = x[y].getAttribute("data-column");
  8130. af[ac] = ae;
  8131. }
  8132. n.updaterow(M.uid, af);
  8133. K.parentNode.removeChild(K);
  8134. n.adaptiveview = null;
  8135. ad.stopPropagation();
  8136. return false;
  8137. });
  8138. w.addEventListener("mousedown", function () {
  8139. K.parentNode.removeChild(K);
  8140. n.adaptiveview = null;
  8141. Y.stopPropagation();
  8142. return false;
  8143. });
  8144. if (this.editable) {
  8145. f.appendChild(A);
  8146. f.appendChild(w);
  8147. K.appendChild(f);
  8148. }
  8149. var v = "<table class='jqx-adaptive-table'><tr>";
  8150. var E = 0;
  8151. for (var S = 0; S < this.columns.records.length; S++) {
  8152. var L = this.columns.records[S];
  8153. if (L.columntype === "adaptive") {continue;}
  8154. if (S > 0 && E % 2 === 0) {v += "</tr><tr>";}
  8155. var B = M[L.displayfield];
  8156. if (L.cellsformat != "") {if (b.jqx.dataFormat) {if (b.jqx.dataFormat.isDate(B)) {B = b.jqx.dataFormat.formatdate(B, L.cellsformat, this.gridlocalization);} else {if (b.jqx.dataFormat.isNumber(B)) {B = b.jqx.dataFormat.formatnumber(B, L.cellsformat, this.gridlocalization);}}}}
  8157. var H = this.filterable ? '<div datafield="' + L.datafield + '" class="' + n.toTP("jqx-grid-column-filterbutton") + '" style="position: relative; top: 4px; display: inline-block; width: 16px; height:16px;"></div>' : "";
  8158. if (this.editable) {if (L.editable) {v += "<td>" + H + L.text + ": <input data-column='" + L.displayfield + "' value='" + B + "'/></td>";} else {v += "<td>" + H + L.text + ": <input data-column='" + L.displayfield + "' readonly value='" + B + "'/></td>";}} else {v += "<td>" + H + L.text + ": " + B + "</td>";}
  8159. E++;
  8160. }
  8161. v += "</tr></table>";
  8162. aa.innerHTML = v;
  8163. e.addEventListener("mousedown", function (i) {
  8164. K.parentNode.removeChild(K);
  8165. n.adaptiveview = null;
  8166. });
  8167. this.wrapper[0].appendChild(K);
  8168. this.adaptiveview = K;
  8169. b(this.adaptiveview).find(".jqx-grid-column-filterbutton").on("click", function () {
  8170. var i = this.getAttribute("datafield");
  8171. var x = this.offsetTop;
  8172. n.openmenu(i);
  8173. setTimeout(function () {
  8174. n.gridmenu.css("top", 30 + x);
  8175. n.gridmenu.css("left", 25);
  8176. n.gridmenu.css("z-index", 99999);
  8177. n.gridmenu.parent().css("z-index", 99999);
  8178. }, 300);
  8179. });
  8180. return;
  8181. }
  8182. this._raiseEvent(8, { rowindex: this.getboundindex(r), column: L ? L.getcolumnproperties() : null, row: r, visibleindex: r.visibleindex, datafield: L ? L.datafield : null, columnindex: G, value: O, rightclick: o, originalEvent: Y });
  8183. if (L.createwidget) {return true;}
  8184. if (this.isTouchDevice()) {
  8185. if (L.columntype == "checkbox" && this.editable && this._overlayElement) {
  8186. if (!this.editcell) {
  8187. this._overlayElement.css("visibility", "hidden");
  8188. this.editcell = this.getcell(E, L.datafield);
  8189. return true;
  8190. }
  8191. } else {
  8192. if (L.columntype == "button" && this._overlayElement) {
  8193. if (L.buttonclick) {L.buttonclick(j.cells[G].buttonrow, Y);}
  8194. return true;
  8195. }
  8196. }
  8197. }
  8198. var h = false;
  8199. if (this._lastmousedown != null) {
  8200. if (this._mousedown - this._lastmousedown < 300) {
  8201. if (this._clickedrowindex == this.getboundindex(r)) {
  8202. this._raiseEvent(22, { rowindex: this.getboundindex(r), row: r, visibleindex: r.visibleindex, group: r.group, rightclick: o, originalEvent: Y });
  8203. if (this._clickedcolumn == L.datafield) {this._raiseEvent(23, { rowindex: this.getboundindex(r), row: r, visibleindex: r.visibleindex, column: L ? L.getcolumnproperties() : null, datafield: L ? L.datafield : null, columnindex: G, value: O, rightclick: o, originalEvent: Y });}
  8204. h = true;
  8205. this._clickedrowindex = -1;
  8206. this._clickedcolumn = null;
  8207. if (Y.isPropagationStopped && Y.isPropagationStopped()) {return false;}
  8208. }
  8209. }
  8210. }
  8211. if (o) {return true;}
  8212. if (!h) {
  8213. this._clickedrowindex = this.getboundindex(r);
  8214. this._clickedcolumn = L.datafield;
  8215. }
  8216. var g = b.jqx.utilities.getBrowser();
  8217. if (g.browser == "msie" && parseInt(g.version) <= 7) {
  8218. if (G == 0 && this.rowdetails) {s = "jqx-grid-group-collapse";}
  8219. if (D > 0) {if (G <= D) {s = "jqx-grid-group-collapse";}}
  8220. }
  8221. if (s.indexOf("jqx-grid-group-expand") != -1 || s.indexOf("jqx-grid-group-collapse") != -1) {
  8222. if (!this.rtl) {
  8223. if (D > 0 && G < D && this._togglegroupstate) {this._togglegroupstate(r.bounddata, true);} else {
  8224. if (G == D && this.rowdetails && this.showrowdetailscolumn) {
  8225. this._togglerowdetails(r.bounddata, true);
  8226. this.gridcontent[0].scrollTop = 0;
  8227. this.gridcontent[0].scrollLeft = 0;
  8228. }
  8229. }
  8230. } else {
  8231. if (D > 0 && G > j.cells.length - D - 1 && this._togglegroupstate) {this._togglegroupstate(r.bounddata, true);} else {
  8232. if (G == j.cells.length - 1 - D && this.rowdetails && this.showrowdetailscolumn) {
  8233. this._togglerowdetails(r.bounddata, true);
  8234. this.gridcontent[0].scrollTop = 0;
  8235. this.gridcontent[0].scrollLeft = 0;
  8236. }
  8237. }
  8238. }
  8239. } else {
  8240. if (r.boundindex != -1) {
  8241. var p = this.selectedrowindexes.slice(0);
  8242. var X = false;
  8243. if (n.selectionmode != "none" && n.selectionmode != "checkbox" && this._selectrowwithmouse) {
  8244. if (n.selectionmode == "multiplecellsadvanced" || n.selectionmode == "multiplecellsextended" || n.selectionmode == "multiplerowsextended" || n.selectionmode == "multiplerowsadvanced") {
  8245. if (!Y.ctrlKey && !Y.shiftKey && !Y.metaKey) {
  8246. n.selectedrowindexes = new Array();
  8247. n.selectedcells = new Array();
  8248. }
  8249. }
  8250. var z = false;
  8251. var q = this.getboundindex(r);
  8252. if (n._oldselectedrow === q || n.selectionmode === "none") {z = true;}
  8253. if (n.selectionmode.indexOf("cell") == -1) {
  8254. if ((n.selectionmode != "singlerow") || (n.selectedrowindex != q && n.selectionmode == "singlerow")) {
  8255. this._applyrowselection(q, true, false, null, L.datafield);
  8256. this._selectrowwithmouse(n, V, p, L.datafield, Y.ctrlKey || Y.metaKey, Y.shiftKey);
  8257. }
  8258. } else {
  8259. if (L.datafield != null) {
  8260. this._selectrowwithmouse(n, V, p, L.datafield, Y.ctrlKey || Y.metaKey, Y.shiftKey);
  8261. if (!Y.shiftKey) {this._applycellselection(q, L.datafield, true, false);}
  8262. }
  8263. }
  8264. if (n._oldselectedcell) {if (n._oldselectedcell.datafield == n.selectedcell.datafield && n._oldselectedcell.rowindex == n.selectedcell.rowindex) {X = true;}}
  8265. n._oldselectedcell = n.selectedcell;
  8266. n._oldselectedrow = q;
  8267. }
  8268. if (n.autosavestate) {if (n.savestate) {n.savestate();}}
  8269. if (n.editable && n.begincelledit && n.editmode != "programmatic") {
  8270. if (Y.isPropagationStopped && Y.isPropagationStopped()) {return false;}
  8271. if (n.editmode == "selectedrow") {
  8272. if (z && !n.editcell) {
  8273. if (L.columntype !== "checkbox") {
  8274. this._currentEditableColumn = G;
  8275. var t = n.beginrowedit(this.getboundindex(r));
  8276. }
  8277. } else {if (n.editcell && !z && n.selectionmode != "none") {var t = n.endrowedit(n.editcell.row);}}
  8278. } else {
  8279. var q = this.getboundindex(r);
  8280. var P = n.editmode == "click" || (X && n.editmode == "selectedcell");
  8281. if (n.selectionmode.indexOf("cell") == -1) {if (n.editmode != "dblclick") {P = true;}}
  8282. if (P) {
  8283. if (r.boundindex != undefined && L.editable) {
  8284. var t = n.begincelledit(this.getboundindex(r), L.datafield, L.defaulteditorvalue);
  8285. if (n.selectionmode.indexOf("cell") != -1) {n._applycellselection(q, L.datafield, false, false);}
  8286. }
  8287. }
  8288. if (n.selectionmode.indexOf("cell") != -1) {if (n.editmode == "selectedcell" && !X && n.editcell) {n.endcelledit(n.editcell.row, n.editcell.column, false, true);}}
  8289. if (n.editmode == "dblclick" && !X && n.editcell && !(n.editcell.row == q && L.datafield == n.editcell.column)) {n.endcelledit(n.editcell.row, n.editcell.column, false, true);}
  8290. }
  8291. return true;
  8292. }
  8293. }
  8294. }
  8295. }
  8296. return true;
  8297. },
  8298. _columnPropertyChanged: function (e, d, g, f) {},
  8299. _rowPropertyChanged: function (g, d, f, e) {},
  8300. _serializeObject: function (d) {
  8301. if (d == null) {return "";}
  8302. var e = "";
  8303. b.each(d, function (g) {
  8304. var i = this;
  8305. if (g > 0) {e += ", ";}
  8306. e += "[";
  8307. var f = 0;
  8308. for (var h in i) {
  8309. if (f > 0) {e += ", ";}
  8310. e += "{" + h + ":" + i[h] + "}";
  8311. f++;
  8312. }
  8313. e += "]";
  8314. });
  8315. return e;
  8316. },
  8317. isbindingcompleted: function () {return !this._loading;},
  8318. propertiesChangedHandler: function (d, e, f) {
  8319. if (f.width && f.height && Object.keys(f).length == 2) {
  8320. d._updatesize(true, true);
  8321. d._resizeWindow();
  8322. if (d.virtualmode && !d._loading) {d.vScrollInstance.setPosition(0);} else {setTimeout(function () {d._renderrows(d.virtualsizeinfo);}, 100);}
  8323. }
  8324. },
  8325. propertyChangedHandler: function (e, f, i, h) {
  8326. if (this.isInitialized == undefined || this.isInitialized == false) {return;}
  8327. if (e.batchUpdate && e.batchUpdate.width && e.batchUpdate.height && Object.keys(e.batchUpdate).length == 2) {return;}
  8328. f = f.toLowerCase();
  8329. switch (f) {
  8330. case"editable":
  8331. case"showcolumnheaderlines":
  8332. case"showcolumnlines":
  8333. case"showrowlines":
  8334. e.refresh();
  8335. break;
  8336. case"everpresentrowactionsmode":
  8337. if (i != h) {
  8338. e._removeaddnewrow();
  8339. e.render();
  8340. }
  8341. break;
  8342. case"everpresentrowactions":
  8343. e._updateaddnewrowui();
  8344. break;
  8345. case"showeverpresentrow":
  8346. case"everpresentrowposition":
  8347. case"everpresentrowheight":
  8348. if (i != h) {
  8349. e._removeaddnewrow();
  8350. e.render();
  8351. }
  8352. break;
  8353. case"rtl":
  8354. e.content.css("left", "");
  8355. e.columns = e._columns;
  8356. e._filterrowcache = [];
  8357. e.vScrollBar.jqxScrollBar({ rtl: h });
  8358. e.hScrollBar.jqxScrollBar({ rtl: h });
  8359. if (e._initpager) {e._initpager();}
  8360. if (e._initgroupsheader) {e._initgroupsheader();}
  8361. e.render();
  8362. break;
  8363. case"enablebrowserselection":
  8364. if (!e.showfilterrow) {
  8365. if (!e.showstatusbar && !e.showtoolbar) {e.host.addClass("jqx-disableselect");}
  8366. e.content.addClass("jqx-disableselect");
  8367. }
  8368. if (e.enablebrowserselection) {
  8369. e.content.removeClass("jqx-disableselect");
  8370. e.host.removeClass("jqx-disableselect");
  8371. }
  8372. break;
  8373. case"columnsheight":
  8374. if (e.columnsheight != 32 || e.columngroups) {e._measureElement("column");}
  8375. e._render(true, true, true, false, false);
  8376. break;
  8377. case"rowsheight":
  8378. if (h != i) {
  8379. if (e.rowsheight != 31) {e._measureElement("cell");}
  8380. e.virtualsizeinfo = null;
  8381. e.rendergridcontent(true, false);
  8382. e.refresh();
  8383. }
  8384. break;
  8385. case"scrollMode":
  8386. e.vScrollInstance.thumbStep = e.rowsheight;
  8387. break;
  8388. case"showdefaultloadelement":
  8389. e._builddataloadelement();
  8390. break;
  8391. case"showfiltermenuitems":
  8392. case"showsortmenuitems":
  8393. case"showgroupmenuitems":
  8394. case"filtermode":
  8395. e._initmenu();
  8396. break;
  8397. case"touchmode":
  8398. if (i != h) {
  8399. e._removeHandlers();
  8400. e.touchDevice = null;
  8401. e.vScrollBar.jqxScrollBar({ touchMode: h });
  8402. e.hScrollBar.jqxScrollBar({ touchMode: h });
  8403. e._updateTouchScrolling();
  8404. e._arrange();
  8405. e._updatecolumnwidths();
  8406. e._updatecellwidths();
  8407. e._addHandlers();
  8408. }
  8409. break;
  8410. case"autoshowcolumnsmenubutton":
  8411. if (i != h) {e._rendercolumnheaders();}
  8412. break;
  8413. case"rendergridrows":
  8414. if (i != h) {e.updatebounddata();}
  8415. break;
  8416. case"editmode":
  8417. if (i != h) {
  8418. e._removeHandlers();
  8419. e._addHandlers();
  8420. }
  8421. break;
  8422. case"source":
  8423. e.updatebounddata();
  8424. if (e.virtualmode && !e._loading) {
  8425. e.loadondemand = true;
  8426. e._renderrows(e.virtualsizeinfo);
  8427. }
  8428. break;
  8429. case"horizontalscrollbarstep":
  8430. case"verticalscrollbarstep":
  8431. case"horizontalscrollbarlargestep":
  8432. case"verticalscrollbarlargestep":
  8433. this.vScrollBar.jqxScrollBar({ step: this.verticalscrollbarstep, largestep: this.verticalscrollbarlargestep });
  8434. this.hScrollBar.jqxScrollBar({ step: this.horizontalscrollbarstep, largestep: this.horizontalscrollbarlargestep });
  8435. break;
  8436. case"closeablegroups":
  8437. if (e._initgroupsheader) {e._initgroupsheader();}
  8438. break;
  8439. case"showgroupsheader":
  8440. if (i != h) {
  8441. e._arrange();
  8442. if (e._initgroupsheader) {e._initgroupsheader();}
  8443. e._renderrows(e.virtualsizeinfo);
  8444. }
  8445. break;
  8446. case"theme":
  8447. if (h != i) {
  8448. b.jqx.utilities.setTheme(i, h, e.host);
  8449. if (e.gridmenu) {e.gridmenu.jqxMenu({ theme: h });}
  8450. if (e.pageable) {e._updatepagertheme();}
  8451. if (e.filterable) {e._updatefilterrowui(true);}
  8452. if (e.showeverpresentrow) {e._updateaddnewrowui(true);}
  8453. }
  8454. break;
  8455. case"showtoolbar":
  8456. case"toolbarheight":
  8457. if (i != h) {
  8458. e._arrange();
  8459. e.refresh();
  8460. }
  8461. break;
  8462. case"showstatusbar":
  8463. if (i != h) {
  8464. if (e.statusbar) {if (h) {e.statusbar.show();} else {e.statusbar.hide();}}
  8465. e._arrange();
  8466. e.refresh();
  8467. }
  8468. break;
  8469. case"statusbarheight":
  8470. if (i != h) {
  8471. e._arrange();
  8472. e.refresh();
  8473. }
  8474. break;
  8475. case"filterable":
  8476. case"showfilterrow":
  8477. if (i != h) {e.render();}
  8478. break;
  8479. case"autoshowfiltericon":
  8480. case"showfiltercolumnbackground":
  8481. case"showpinnedcolumnbackground":
  8482. case"showsortcolumnbackground":
  8483. if (i != h) {e.rendergridcontent();}
  8484. break;
  8485. case"showrowdetailscolumn":
  8486. if (i != h) {e.render();}
  8487. break;
  8488. case"scrollbarsize":
  8489. if (i != h) {
  8490. b.jqx.utilities.scrollBarSize = h;
  8491. e._arrange();
  8492. }
  8493. break;
  8494. case"width":
  8495. case"height":
  8496. if (i != h) {
  8497. e._updatesize(true, true);
  8498. e._resizeWindow();
  8499. if (e.virtualmode && !e._loading) {e.vScrollInstance.setPosition(0);} else {setTimeout(function () {e._renderrows(e.virtualsizeinfo);}, 100);}
  8500. }
  8501. break;
  8502. case"altrows":
  8503. case"altstart":
  8504. case"altstep":
  8505. if (i != h) {e._renderrows(e.virtualsizeinfo);}
  8506. break;
  8507. case"groupsheaderheight":
  8508. if (i != h) {
  8509. e._arrange();
  8510. if (e._initgroupsheader) {e._initgroupsheader();}
  8511. }
  8512. break;
  8513. case"pagerheight":
  8514. if (i != h) {e._initpager();}
  8515. break;
  8516. case"selectedrowindex":
  8517. e.selectrow(h);
  8518. break;
  8519. case"selectionmode":
  8520. if (i != h) {
  8521. if (h == "none") {
  8522. e.selectedrowindexes = new Array();
  8523. e.selectedcells = new Array();
  8524. e.selectedrowindex = -1;
  8525. }
  8526. e._renderrows(e.virtualsizeinfo);
  8527. if (h == "checkbox") {e._render(false, false, true, false, false);}
  8528. }
  8529. break;
  8530. case"showheader":
  8531. if (h) {e.columnsheader.css("display", "block");} else {e.columnsheader.css("display", "none");}
  8532. break;
  8533. case"virtualmode":
  8534. if (i != h) {
  8535. e.dataview.virtualmode = e.virtualmode;
  8536. e.dataview.refresh(false);
  8537. e._render(false, false, false);
  8538. }
  8539. break;
  8540. case"columnsmenu":
  8541. if (i != h) {e.render();}
  8542. break;
  8543. case"columngroups":
  8544. e._render(true, true, true, false, false);
  8545. break;
  8546. case"columns":
  8547. if (e.columns && e.columns.length > e.headerZIndex) {e.headerZIndex = e.columns.length + 100;}
  8548. if (e._serializeObject(e._cachedcolumns) !== e._serializeObject(h)) {
  8549. var d = false;
  8550. if (e.filterable) {
  8551. if (i && i.records) {
  8552. b.each(i.records, function () {
  8553. if (this.filter) {d = true;}
  8554. e.dataview.removefilter(this.displayfield, this.filter);
  8555. });
  8556. }
  8557. }
  8558. e._columns = null;
  8559. e._filterrowcache = [];
  8560. e.render();
  8561. if (d) {e.applyfilters();}
  8562. e._cachedcolumns = e.columns;
  8563. if (e.removesort) {e.removesort();}
  8564. } else {e[f] = i;}
  8565. break;
  8566. case"autoheight":
  8567. if (i != h) {e._render(false, false, true);}
  8568. break;
  8569. case"pagermode":
  8570. case"pagerbuttonscount":
  8571. if (i != h) {
  8572. if (e._initpager) {
  8573. if (e.pagershowrowscombo) {
  8574. e.pagershowrowscombo.jqxDropDownList("destroy");
  8575. e.pagershowrowscombo = null;
  8576. }
  8577. if (e.pagerrightbutton) {
  8578. e.removeHandler(e.pagerrightbutton, "mousedown");
  8579. e.removeHandler(e.pagerrightbutton, "mouseup");
  8580. e.removeHandler(e.pagerrightbutton, "click");
  8581. e.pagerrightbutton.jqxButton("destroy");
  8582. e.pagerrightbutton = null;
  8583. }
  8584. if (e.pagerleftbutton) {
  8585. e.removeHandler(e.pagerleftbutton, "mousedown");
  8586. e.removeHandler(e.pagerleftbutton, "mouseup");
  8587. e.removeHandler(e.pagerleftbutton, "click");
  8588. e.pagerleftbutton.jqxButton("destroy");
  8589. e.removeHandler(b(document), "mouseup.pagerbuttons" + e.element.id);
  8590. e.pagerleftbutton = null;
  8591. }
  8592. e.pagerdiv.remove();
  8593. e._initpager();
  8594. }
  8595. }
  8596. break;
  8597. case"pagesizeoptions":
  8598. case"pageable":
  8599. case"pagesize":
  8600. if (i != h) {
  8601. if (e._loading) {
  8602. throw new Error("jqxGrid: " + e.loadingerrormessage);
  8603. return;
  8604. }
  8605. if (!e.host.jqxDropDownList || !e.host.jqxListBox) {
  8606. e._testmodules();
  8607. return;
  8608. }
  8609. if (e._initpager) {
  8610. if (f != "pageable" && f != "pagermode") {
  8611. if (typeof (h) == "string") {
  8612. var g = "The expected value type is: Int.";
  8613. if (f != "pagesize") {var g = "The expected value type is: Array of Int values.";}
  8614. throw new Error("Invalid Value for: " + f + ". " + g);
  8615. }
  8616. }
  8617. e.dataview.pageable = e.pageable;
  8618. e.dataview.pagenum = 0;
  8619. e.dataview.pagesize = e._getpagesize();
  8620. if (e.virtualmode) {e.updatebounddata();}
  8621. e.dataview.refresh(true);
  8622. e._initpager();
  8623. if (f == "pagesizeoptions") {
  8624. if (h != null && h.length > 0) {
  8625. e.pagesize = parseInt(h[0]);
  8626. e.dataview.pagesize = parseInt(h[0]);
  8627. e.prerenderrequired = true;
  8628. e._requiresupdate = true;
  8629. e.dataview.pagenum = -1;
  8630. e.gotopage(0);
  8631. }
  8632. }
  8633. }
  8634. e._render(false, false, false);
  8635. }
  8636. break;
  8637. case"groups":
  8638. if (e._serializeObject(i) !== e._serializeObject(h)) {
  8639. e.dataview.groups = h;
  8640. e._refreshdataview();
  8641. e._render(true, true, true, false);
  8642. }
  8643. break;
  8644. case"groupable":
  8645. if (i != h) {
  8646. e.dataview.groupable = e.groupable;
  8647. e.dataview.pagenum = 0;
  8648. e.dataview.refresh(false);
  8649. e._render(false, false, true);
  8650. }
  8651. break;
  8652. case"renderstatusbar":
  8653. if (h != null) {e.renderstatusbar(e.statusbar);}
  8654. break;
  8655. case"rendertoolbar":
  8656. if (h != null) {e.rendertoolbar(e.toolbar);}
  8657. break;
  8658. case"disabled":
  8659. if (h) {e.host.addClass(e.toThemeProperty("jqx-fill-state-disabled"));} else {e.host.removeClass(e.toThemeProperty("jqx-fill-state-disabled"));}
  8660. b.jqx.aria(e, "aria-disabled", e.disabled);
  8661. if (e.pageable) {
  8662. if (e.pagerrightbutton) {
  8663. e.pagerrightbutton.jqxButton({ disabled: h });
  8664. e.pagerleftbutton.jqxButton({ disabled: h });
  8665. e.pagershowrowscombo.jqxDropDownList({ disabled: h });
  8666. e.pagergotoinput.attr("disabled", h);
  8667. }
  8668. if (e.pagerfirstbutton) {
  8669. e.pagerfirstbutton.jqxButton({ disabled: h });
  8670. e.pagerlastbutton.jqxButton({ disabled: h });
  8671. }
  8672. }
  8673. e.vScrollBar.jqxScrollBar({ disabled: h });
  8674. e.hScrollBar.jqxScrollBar({ disabled: h });
  8675. if (e.filterable && e.showfilterrow) {e._updatefilterrowui(true);}
  8676. if (e.showeverpresentrow) {e._updateaddnewrowui(true);}
  8677. break;
  8678. }
  8679. }
  8680. });
  8681. function c(d, e) {
  8682. this.owner = d;
  8683. this.datafield = null;
  8684. this.displayfield = null;
  8685. this.text = "";
  8686. this.createfilterpanel = null;
  8687. this.sortable = true;
  8688. this.hideable = true;
  8689. this.editable = true;
  8690. this.hidden = false;
  8691. this.adaptivehidden = false;
  8692. this.groupable = true;
  8693. this.renderer = null;
  8694. this.cellsrenderer = null;
  8695. this.checkchange = null, this.threestatecheckbox = false;
  8696. this.buttonclick = null, this.columntype = null;
  8697. this.cellsformat = "";
  8698. this.align = "left";
  8699. this.cellsalign = "left";
  8700. this.width = "auto";
  8701. this.minwidth = 25;
  8702. this.maxwidth = "auto";
  8703. this.pinned = false;
  8704. this.visibleindex = -1;
  8705. this.filterable = true;
  8706. this.filter = null;
  8707. this.filteritems = [];
  8708. this.resizable = true;
  8709. this.initeditor = null;
  8710. this.createeditor = null;
  8711. this.createwidget = null;
  8712. this.initwidget = null;
  8713. this.destroywidget = null;
  8714. this.destroyeditor = null;
  8715. this.geteditorvalue = null;
  8716. this.validation = null;
  8717. this.classname = "";
  8718. this.cellclassname = "";
  8719. this.cellendedit = null;
  8720. this.cellbeginedit = null;
  8721. this.cellvaluechanging = null;
  8722. this.aggregates = null;
  8723. this.aggregatesrenderer = null;
  8724. this.menu = true;
  8725. this.createfilterwidget = null;
  8726. this.filtertype = "default";
  8727. this.filtercondition = null;
  8728. this.rendered = null;
  8729. this.exportable = true;
  8730. this.exporting = false;
  8731. this.draggable = true;
  8732. this.nullable = true;
  8733. this.clipboard = true;
  8734. this.selectable = false;
  8735. this._applyStyle = function () {
  8736. var f = this;
  8737. if (f.hovered) {
  8738. if (f.style.headerBackgroundHoveredColor) {f.element.style.backgroundColor = f.style.headerBackgroundHoveredColor;}
  8739. if (f.style.headerHoveredColor) {f.element.style.color = f.style.headerHoveredColor;}
  8740. return;
  8741. }
  8742. if (f.selected) {
  8743. if (f.style.headerBackgroundSelectedColor) {f.element.style.backgroundColor = f.style.headerBackgroundSelectedColor;}
  8744. if (f.style.headerSelectedColor) {f.element.style.color = f.style.headerSelectedColor;}
  8745. return;
  8746. }
  8747. if (f.style.headerBackgroundColor) {f.element.style.backgroundColor = f.style.headerBackgroundColor;} else {f.element.style.backgroundColor = "";}
  8748. if (f.style.headerColor) {f.element.style.color = f.style.headerColor;} else {f.element.style.color = "";}
  8749. };
  8750. this._applyCellStyle = function (f) {
  8751. var j = this;
  8752. var g = false;
  8753. if (f.length) {
  8754. for (var h = 0; h < f.length; h++) {this._applyCellStyle(f[h]);}
  8755. return;
  8756. }
  8757. if (j.style.backgroundColor || j.style.color || j.style.hoveredColor || j.style.hoveredColor || j.style.backgroundSelectedColor || j.style.selectedColor) {g = true;}
  8758. if (!g) {return;}
  8759. if (f.className.indexOf("hover") >= 0) {
  8760. if (j.style.backgroundHoveredColor) {f.style.backgroundColor = j.style.backgroundHoveredColor;}
  8761. if (j.style.hoveredColor) {f.style.color = j.style.hoveredColor;}
  8762. return;
  8763. }
  8764. if (f.className.indexOf("selected") >= 0) {
  8765. if (j.style.backgroundSelectedColor) {f.style.backgroundColor = j.style.backgroundSelectedColor;}
  8766. if (j.style.selectedColor) {f.style.color = j.style.selectedColor;}
  8767. return;
  8768. }
  8769. if (j.style.backgroundColor) {f.style.backgroundColor = j.style.backgroundColor;}
  8770. if (j.style.color) {f.style.color = j.style.color;}
  8771. };
  8772. this.style = {
  8773. headerBackgroundColor: "",
  8774. headerColor: "",
  8775. headerBackgroundHoveredColor: "",
  8776. headerHoveredColor: "",
  8777. headerBackgroundSelectedColor: "",
  8778. headerSelectedColor: "",
  8779. backgroundColor: "",
  8780. color: "",
  8781. backgroundHoveredColor: "",
  8782. hoveredColor: "",
  8783. backgroundSelectedColor: "",
  8784. selectedColor: ""
  8785. };
  8786. this.enabletooltips = true;
  8787. this.columngroup = null;
  8788. this.filterdelay = 800;
  8789. this.reseteverpresentrowwidgetvalue = null;
  8790. this.geteverpresentrowwidgetvalue = null;
  8791. this.createeverpresentrowwidget = null;
  8792. this.initeverpresentrowwidget = null;
  8793. this.validateeverpresentrowwidgetvalue = null;
  8794. this.destroyeverpresentrowwidget = null;
  8795. this.getcolumnproperties = function () {
  8796. return {
  8797. nullable: this.nullable,
  8798. sortable: this.sortable,
  8799. hideable: this.hideable,
  8800. hidden: this.hidden,
  8801. groupable: this.groupable,
  8802. width: this.width,
  8803. align: this.align,
  8804. editable: this.editable,
  8805. minwidth: this.minwidth,
  8806. maxwidth: this.maxwidth,
  8807. resizable: this.resizable,
  8808. datafield: this.datafield,
  8809. text: this.text,
  8810. exportable: this.exportable,
  8811. cellsalign: this.cellsalign,
  8812. pinned: this.pinned,
  8813. cellsformat: this.cellsformat,
  8814. columntype: this.columntype,
  8815. classname: this.classname,
  8816. cellclassname: this.cellclassname,
  8817. menu: this.menu
  8818. };
  8819. }, this.setproperty = function (f, g) {
  8820. if (this[f]) {
  8821. var h = this[f];
  8822. this[f] = g;
  8823. this.owner._columnPropertyChanged(this, f, g, h);
  8824. } else {
  8825. if (this[f.toLowerCase()]) {
  8826. var h = this[f.toLowerCase()];
  8827. this[f.toLowerCase()] = g;
  8828. this.owner._columnPropertyChanged(this, f.toLowerCase(), g, h);
  8829. }
  8830. }
  8831. };
  8832. this._initfields = function (g) {
  8833. if (g != null) {
  8834. var f = this.that;
  8835. if (b.jqx.hasProperty(g, "dataField")) {this.datafield = b.jqx.get(g, "dataField");}
  8836. if (b.jqx.hasProperty(g, "selectable")) {this.selectable = b.jqx.get(g, "selectable");}
  8837. if (b.jqx.hasProperty(g, "displayField")) {this.displayfield = b.jqx.get(g, "displayField");} else {this.displayfield = this.datafield;}
  8838. if (b.jqx.hasProperty(g, "enableTooltips")) {this.enabletooltips = b.jqx.get(g, "enableTooltips");}
  8839. if (b.jqx.hasProperty(g, "text")) {this.text = b.jqx.get(g, "text");} else {this.text = this.displayfield;}
  8840. if (b.jqx.hasProperty(g, "style")) {this.style = b.jqx.get(g, "style");}
  8841. if (b.jqx.hasProperty(g, "createfilterpanel")) {this.createfilterpanel = b.jqx.get(g, "createfilterpanel");}
  8842. if (b.jqx.hasProperty(g, "sortable")) {this.sortable = b.jqx.get(g, "sortable");}
  8843. if (b.jqx.hasProperty(g, "hideable")) {this.hideable = b.jqx.get(g, "hideable");}
  8844. if (b.jqx.hasProperty(g, "hidden")) {this.hidden = b.jqx.get(g, "hidden");}
  8845. if (b.jqx.hasProperty(g, "adaptivehidden")) {this.adaptivehidden = b.jqx.get(g, "adaptivehidden");}
  8846. if (b.jqx.hasProperty(g, "groupable")) {this.groupable = b.jqx.get(g, "groupable");}
  8847. if (b.jqx.hasProperty(g, "renderer")) {this.renderer = b.jqx.get(g, "renderer");}
  8848. if (b.jqx.hasProperty(g, "align")) {this.align = b.jqx.get(g, "align");}
  8849. if (b.jqx.hasProperty(g, "cellsAlign")) {this.cellsalign = b.jqx.get(g, "cellsAlign");}
  8850. if (b.jqx.hasProperty(g, "clipboard")) {this.clipboard = b.jqx.get(g, "clipboard");}
  8851. if (b.jqx.hasProperty(g, "cellsFormat")) {this.cellsformat = b.jqx.get(g, "cellsFormat");}
  8852. if (b.jqx.hasProperty(g, "width")) {this.width = b.jqx.get(g, "width");}
  8853. if (b.jqx.hasProperty(g, "minWidth")) {
  8854. this.minwidth = parseInt(b.jqx.get(g, "minWidth"));
  8855. if (isNaN(this.minwidth)) {this.minwidth = 25;}
  8856. }
  8857. if (b.jqx.hasProperty(g, "maxWidth")) {
  8858. this.maxwidth = parseInt(b.jqx.get(g, "maxWidth"));
  8859. if (isNaN(this.maxwidth)) {this.maxwidth = "auto";}
  8860. }
  8861. if (b.jqx.hasProperty(g, "cellsRenderer")) {this.cellsrenderer = b.jqx.get(g, "cellsRenderer");} else {if (g.cellsRenderer) {this.cellsrenderer = g.cellsRenderer;}}
  8862. if (b.jqx.hasProperty(g, "columnType")) {this.columntype = b.jqx.get(g, "columnType");}
  8863. if (b.jqx.hasProperty(g, "checkChange")) {this.checkchange = b.jqx.get(g, "checkChange");}
  8864. if (b.jqx.hasProperty(g, "buttonClick")) {this.buttonclick = b.jqx.get(g, "buttonClick");} else {if (g.buttonClick) {this.buttonclick = g.buttonClick;}}
  8865. if (b.jqx.hasProperty(g, "pinned")) {this.pinned = b.jqx.get(g, "pinned");}
  8866. if (b.jqx.hasProperty(g, "visibleIndex")) {this.visibleindex = b.jqx.get(g, "visibleIndex");}
  8867. if (b.jqx.hasProperty(g, "filterable")) {this.filterable = b.jqx.get(g, "filterable");}
  8868. if (b.jqx.hasProperty(g, "filter")) {this.filter = b.jqx.get(g, "filter");}
  8869. if (b.jqx.hasProperty(g, "resizable")) {this.resizable = b.jqx.get(g, "resizable");}
  8870. if (b.jqx.hasProperty(g, "editable")) {this.editable = b.jqx.get(g, "editable");}
  8871. if (b.jqx.hasProperty(g, "initEditor")) {this.initeditor = b.jqx.get(g, "initEditor");} else {if (g.initEditor) {this.initeditor = g.initEditor;}}
  8872. if (b.jqx.hasProperty(g, "createEditor")) {this.createeditor = b.jqx.get(g, "createEditor");} else {if (g.createEditor) {this.createeditor = g.createEditor;}}
  8873. if (b.jqx.hasProperty(g, "initWidget")) {this.initwidget = b.jqx.get(g, "initWidget");} else {if (g.initWidget) {this.initwidget = g.initWidget;}}
  8874. if (b.jqx.hasProperty(g, "createWidget")) {this.createwidget = b.jqx.get(g, "createWidget");} else {if (g.createWidget) {this.createwidget = g.createWidget;}}
  8875. if (b.jqx.hasProperty(g, "destroyWidget")) {this.destroywidget = b.jqx.get(g, "destroyWidget");} else {if (g.destroyWidget) {this.destroywidget = g.destroyWidget;}}
  8876. if (b.jqx.hasProperty(g, "reseteverpresentrowwidgetvalue") || b.jqx.hasFunction(g, "reseteverpresentrowwidgetvalue")) {this.reseteverpresentrowwidgetvalue = b.jqx.get(g, "reseteverpresentrowwidgetvalue");} else {if (g.resetEverPresentRowWidgetValue) {this.reseteverpresentrowwidgetvalue = g.resetEverPresentRowWidgetValue;}}
  8877. if (b.jqx.hasProperty(g, "geteverpresentrowwidgetvalue") || b.jqx.hasFunction(g, "geteverpresentrowwidgetvalue")) {this.geteverpresentrowwidgetvalue = b.jqx.get(g, "geteverpresentrowwidgetvalue");} else {if (g.getEverPresentRowWidgetValue) {this.geteverpresentrowwidgetvalue = g.getEverPresentRowWidgetValue;}}
  8878. if (b.jqx.hasProperty(g, "createeverpresentrowwidget") || b.jqx.hasFunction(g, "createeverpresentrowwidget")) {this.createeverpresentrowwidget = b.jqx.get(g, "createeverpresentrowwidget");} else {if (g.createEverPresentRowWidget) {this.createeverpresentrowwidget = g.createEverPresentRowWidget;}}
  8879. if (b.jqx.hasProperty(g, "initeverpresentrowwidget") || b.jqx.hasFunction(g, "initeverpresentrowwidget")) {this.initeverpresentrowwidget = b.jqx.get(g, "initeverpresentrowwidget");} else {if (g.initEverPresentRowWidget) {this.initeverpresentrowwidget = g.initEverPresentRowWidget;}}
  8880. if (b.jqx.hasProperty(g, "validateeverpresentrowwidgetvalue")) {this.validateeverpresentrowwidgetvalue = b.jqx.get(g, "validateeverpresentrowwidgetvalue");} else {if (g.validateEverPresentRowWidgetValue) {this.validateeverpresentrowwidgetvalue = g.validateEverPresentRowWidgetValue;}}
  8881. if (b.jqx.hasProperty(g, "destroyeverpresentrowwidget") || b.jqx.hasFunction(g, "destroyeverpresentrowwidget")) {this.destroyeverpresentrowwidget = b.jqx.get(g, "destroyeverpresentrowwidget");} else {if (g.destroyEverPresentRowWidget) {this.destroyEverPresentRowWidget = g.destroyEverPresentRowWidget;}}
  8882. if (b.jqx.hasProperty(g, "destroyEditor")) {this.destroyeditor = b.jqx.get(g, "destroyEditor");} else {if (g.destroyEditor) {this.destroyeditor = g.destroyEditor;}}
  8883. if (b.jqx.hasProperty(g, "getEditorValue")) {this.geteditorvalue = b.jqx.get(g, "getEditorValue");} else {if (g.getEditorValue) {this.geteditorvalue = g.getEditorValue;}}
  8884. if (b.jqx.hasProperty(g, "validation")) {this.validation = b.jqx.get(g, "validation");} else {if (g.validation) {this.validation = g.validation;}}
  8885. if (b.jqx.hasProperty(g, "cellBeginEdit")) {this.cellbeginedit = b.jqx.get(g, "cellBeginEdit");} else {if (g.cellBeginEdit) {this.cellbeginedit = g.cellBeginEdit;}}
  8886. if (b.jqx.hasProperty(g, "cellEndEdit")) {this.cellendedit = b.jqx.get(g, "cellEndEdit");} else {if (g.cellEndEdit) {this.cellendedit = g.cellEndEdit;}}
  8887. if (b.jqx.hasProperty(g, "className")) {this.classname = b.jqx.get(g, "className");}
  8888. if (b.jqx.hasProperty(g, "cellClassName")) {this.cellclassname = b.jqx.get(g, "cellClassName");} else {if (g.cellClassName) {this.cellclassname = g.cellClassName;}}
  8889. if (b.jqx.hasProperty(g, "menu")) {this.menu = b.jqx.get(g, "menu");}
  8890. if (b.jqx.hasProperty(g, "aggregates")) {this.aggregates = b.jqx.get(g, "aggregates");}
  8891. if (b.jqx.hasProperty(g, "aggregatesRenderer")) {this.aggregatesrenderer = b.jqx.get(g, "aggregatesRenderer");}
  8892. if (b.jqx.hasProperty(g, "createFilterWidget")) {this.createfilterwidget = b.jqx.get(g, "createFilterWidget");}
  8893. if (b.jqx.hasProperty(g, "filterType")) {this.filtertype = b.jqx.get(g, "filterType");}
  8894. if (b.jqx.hasProperty(g, "filterDelay")) {this.filterdelay = b.jqx.get(g, "filterDelay");}
  8895. if (b.jqx.hasProperty(g, "rendered")) {this.rendered = b.jqx.get(g, "rendered");}
  8896. if (b.jqx.hasProperty(g, "exportable")) {this.exportable = b.jqx.get(g, "exportable");}
  8897. if (b.jqx.hasProperty(g, "filterItems")) {this.filteritems = b.jqx.get(g, "filterItems");}
  8898. if (b.jqx.hasProperty(g, "cellValueChanging")) {this.cellvaluechanging = b.jqx.get(g, "cellValueChanging");}
  8899. if (b.jqx.hasProperty(g, "draggable")) {this.draggable = b.jqx.get(g, "draggable");}
  8900. if (b.jqx.hasProperty(g, "filterCondition")) {this.filtercondition = b.jqx.get(g, "filterCondition");}
  8901. if (b.jqx.hasProperty(g, "threeStateCheckbox")) {this.threestatecheckbox = b.jqx.get(g, "threeStateCheckbox");}
  8902. if (b.jqx.hasProperty(g, "nullable")) {this.nullable = b.jqx.get(g, "nullable");}
  8903. if (b.jqx.hasProperty(g, "columnGroup")) {this.columngroup = b.jqx.get(g, "columnGroup");}
  8904. if (!g instanceof String && !(typeof g == "string")) {
  8905. for (var h in g) {
  8906. if (!f.hasOwnProperty(h)) {
  8907. if (!f.hasOwnProperty(h.toLowerCase())) {
  8908. d.host.remove();
  8909. throw new Error("jqxGrid: Invalid property name - " + h + ".");
  8910. }
  8911. }
  8912. }
  8913. }
  8914. }
  8915. };
  8916. this._initfields(e);
  8917. return this;
  8918. }
  8919. function a(d, e) {
  8920. this.setdata = function (f) {
  8921. if (f != null) {
  8922. this.bounddata = f;
  8923. this.boundindex = f.boundindex;
  8924. this.visibleindex = f.visibleindex;
  8925. this.group = f.group;
  8926. this.parentbounddata = f.parentItem;
  8927. this.uniqueid = f.uniqueid;
  8928. this.level = f.level;
  8929. }
  8930. };
  8931. this.setdata(e);
  8932. this.parentrow = null;
  8933. this.subrows = new Array();
  8934. this.owner = d;
  8935. this.height = 25;
  8936. this.hidden = false;
  8937. this.rowdetails = null;
  8938. this.rowdetailsheight = 100;
  8939. this.rowdetailshidden = true;
  8940. this.top = -1;
  8941. this.setrowinfo = function (f) {
  8942. this.hidden = f.hidden;
  8943. this.rowdetails = f.rowdetails;
  8944. this.rowdetailsheight = f.rowdetailsheight;
  8945. this.rowdetailshidden = !f.showdetails;
  8946. this.height = f.height;
  8947. };
  8948. return this;
  8949. }
  8950. b.jqx.collection = function (d) {
  8951. this.records = new Array();
  8952. this.owner = d;
  8953. this.updating = false;
  8954. this.beginupdate = function () {this.updating = true;};
  8955. this.resumeupdate = function () {this.updating = false;};
  8956. this._raiseEvent = function (e) {};
  8957. this.clear = function () {this.records = new Array();};
  8958. this.replace = function (f, e) {
  8959. this.records[f] = e;
  8960. if (!this.updating) {this._raiseEvent({ type: "replace", element: e });}
  8961. };
  8962. this.isempty = function (e) {
  8963. if (this.records[e] == undefined) {return true;}
  8964. return false;
  8965. };
  8966. this.initialize = function (e) {
  8967. if (e < 1) {e = 1;}
  8968. this.records[e - 1] = -1;
  8969. };
  8970. this.length = function () {return this.records.length;};
  8971. this.indexOf = function (e) {return this.records.indexOf(e);};
  8972. this.add = function (e) {
  8973. if (e == null) {return false;}
  8974. this.records[this.records.length] = e;
  8975. if (!this.updating) {this._raiseEvent({ type: "add", element: e });}
  8976. return true;
  8977. };
  8978. this.insertAt = function (f, e) {
  8979. if (f == null || f == undefined) {return false;}
  8980. if (e == null) {return false;}
  8981. if (f >= 0) {
  8982. if (f < this.records.length) {
  8983. this.records.splice(f, 0, e);
  8984. if (!this.updating) {this._raiseEvent({ type: "insert", index: f, element: e });}
  8985. return true;
  8986. } else {return this.add(e);}
  8987. }
  8988. return false;
  8989. };
  8990. this.remove = function (f) {
  8991. if (f == null || f == undefined) {return false;}
  8992. var e = this.records.indexOf(f);
  8993. if (e != -1) {
  8994. this.records.splice(e, 1);
  8995. if (!this.updating) {this._raiseEvent({ type: "remove", element: f });}
  8996. return true;
  8997. }
  8998. return false;
  8999. };
  9000. this.removeAt = function (f) {
  9001. if (f == null || f == undefined) {return false;}
  9002. if (f < 0) {return false;}
  9003. if (f < this.records.length) {
  9004. var e = this.records[f];
  9005. this.records.splice(f, 1);
  9006. if (!this.updating) {this._raiseEvent({ type: "removeAt", index: f, element: e });}
  9007. return true;
  9008. }
  9009. return false;
  9010. };
  9011. return this;
  9012. };
  9013. b.jqx.dataview = function () {
  9014. this.self = this;
  9015. this.aggregates = false;
  9016. this.grid = null;
  9017. this.uniqueId = "id";
  9018. this.records = [];
  9019. this.rows = [];
  9020. this.columns = [];
  9021. this.groups = [];
  9022. this.filters = new Array();
  9023. this.updated = null;
  9024. this.update = null;
  9025. this.suspend = false;
  9026. this.pagesize = 0;
  9027. this.pagenum = 0;
  9028. this.totalrows = 0;
  9029. this.totalrecords = 0;
  9030. this.groupable = true;
  9031. this.loadedrecords = [];
  9032. this.loadedrootgroups = [];
  9033. this.loadedgroups = [];
  9034. this.loadedgroupsByKey = [];
  9035. this.virtualmode = true;
  9036. this._cachegrouppages = new Array();
  9037. this.source = null;
  9038. this.changedrecords = new Array();
  9039. this.rowschangecallback = null;
  9040. this.that = this;
  9041. this.destroy = function () {
  9042. delete this.self;
  9043. delete this.grid;
  9044. delete this.uniqueId;
  9045. delete this.records;
  9046. delete this.rows;
  9047. delete this.columns;
  9048. delete this.groups;
  9049. delete this.filters;
  9050. delete this.updated;
  9051. delete this.update;
  9052. delete this.suspend;
  9053. delete this.pagesize;
  9054. delete this.pagenum;
  9055. delete this.totalrows;
  9056. delete this.totalrecords;
  9057. delete this.groupable;
  9058. delete this.loadedrecords;
  9059. delete this.loadedrootgroups;
  9060. delete this.loadedgroups;
  9061. delete this.loadedgroupsByKey;
  9062. delete this.virtualmode;
  9063. delete this._cachegrouppages;
  9064. delete this.source;
  9065. delete this.changedrecords;
  9066. delete this.rowschangecallback;
  9067. delete this.that;
  9068. }, this.suspendupdate = function () {this.suspend = true;}, this.isupdating = function () {return this.suspend;}, this.resumeupdate = function (d) {
  9069. this.suspend = false;
  9070. if (d == undefined) {d = true;}
  9071. this.refresh(d);
  9072. }, this.getrecords = function () {return this.records;}, this.clearrecords = function () {this.recordids = new Array();};
  9073. this.databind = function (y, p) {
  9074. var w = y._source ? true : false;
  9075. var h = null;
  9076. if (this.grid) {this.aggregates = this.grid.showgroupaggregates;}
  9077. if (w) {
  9078. h = y;
  9079. y = y._source;
  9080. } else {h = new b.jqx.dataAdapter(y, { autoBind: false });}
  9081. var f = function (m) {
  9082. h.recordids = [];
  9083. h.records = new Array();
  9084. h.cachedrecords = new Array();
  9085. h.originaldata = new Array();
  9086. h._options.virtualmode = m.virtualmode;
  9087. h._options.totalrecords = m.totalrecords;
  9088. h._options.originaldata = m.originaldata;
  9089. h._options.recordids = m.recordids;
  9090. h._options.cachedrecords = new Array();
  9091. h._options.pagenum = m.pagenum;
  9092. h._options.pageable = m.pageable;
  9093. if (y.type != undefined) {h._options.type = y.type;}
  9094. if (y.formatdata != undefined) {h._options.formatData = y.formatdata;}
  9095. if (y.contenttype != undefined) {h._options.contentType = y.contenttype;}
  9096. if (y.async != undefined) {h._options.async = y.async;}
  9097. if (y.updaterow != undefined) {h._options.updaterow = y.updaterow;}
  9098. if (y.addrow != undefined) {h._options.addrow = y.addrow;}
  9099. if (y.deleterow != undefined) {h._options.deleterow = y.deleterow;}
  9100. if (m.pagesize == 0) {m.pagesize = 10;}
  9101. h._options.pagesize = m.pagesize;
  9102. };
  9103. var B = function (I) {
  9104. I.totalrecords = h.totalrecords;
  9105. if (!I.virtualmode) {
  9106. I.originaldata = h.originaldata;
  9107. I.records = h.records;
  9108. I.recordids = h.recordids;
  9109. I.cachedrecords = h.cachedrecords;
  9110. } else {
  9111. var m = { startindex: I.pagenum * I.pagesize, endindex: (I.pagenum * I.pagesize + I.pagesize) };
  9112. if (y.recordstartindex != undefined) {m.startindex = parseInt(y.recordstartindex);}
  9113. if (y.recordendindex != undefined) {m.endindex = parseInt(y.recordendindex);} else {
  9114. if (!I.grid.pageable) {
  9115. m.endindex = m.startindex + 100;
  9116. if (I.grid.autoheight) {m.endindex = m.startindex + I.totalrecords;}
  9117. }
  9118. }
  9119. if (!y.recordendindex) {
  9120. if (!I.grid.pageable) {
  9121. m.endindex = m.startindex + 100;
  9122. if (I.grid.autoheight) {m.endindex = m.startindex + I.totalrecords;}
  9123. } else {m = { startindex: I.pagenum * I.pagesize, endindex: (I.pagenum * I.pagesize + I.pagesize) };}
  9124. }
  9125. m.data = h.records;
  9126. if (I.grid.rendergridrows && I.totalrecords > 0) {
  9127. var J = 0;
  9128. y.records = I.grid.rendergridrows(m);
  9129. if (y.records.length) {J = y.records.length;}
  9130. if (y.records && !y.records[m.startindex]) {
  9131. var K = new Array();
  9132. var H = m.startindex;
  9133. b.each(y.records, function () {
  9134. K[H] = this;
  9135. H++;
  9136. J++;
  9137. });
  9138. y.records = K;
  9139. }
  9140. if (J == 0) {if (y.records) {b.each(y.records, function () {J++;});}}
  9141. if (J > 0 && J < m.endindex - m.startindex && !I.grid.groupable) {
  9142. var x = y.records[0];
  9143. for (var q = 0; q < m.endindex - m.startindex - J; q++) {
  9144. var L = {};
  9145. for (var o in x) {L[o] = "";}
  9146. if (y.records.push) {y.records.push(L);}
  9147. }
  9148. }
  9149. }
  9150. if (!y.records || I.totalrecords == 0) {y.records = new Array();}
  9151. I.originaldata = y.records;
  9152. I.records = y.records;
  9153. I.cachedrecords = y.records;
  9154. }
  9155. };
  9156. f(this);
  9157. this.source = y;
  9158. if (p !== undefined) {var k = p;}
  9159. var G = this.that;
  9160. switch (y.datatype) {
  9161. case"local":
  9162. case"array":
  9163. default:
  9164. if (y.localdata == null) {y.localdata = [];}
  9165. if (y.localdata != null) {
  9166. h.unbindBindingUpdate(G.grid.element.id);
  9167. if ((!G.grid.autobind && G.grid.isInitialized) || G.grid.autobind) {h.dataBind();}
  9168. var n = function (o) {
  9169. if (o != undefined && o != "") {
  9170. var q = h._changedrecords[0];
  9171. if (q) {
  9172. var x = new Array();
  9173. b.each(h._changedrecords, function (K) {
  9174. var H = this.index;
  9175. var I = this.record;
  9176. G.grid._updateFromAdapter = true;
  9177. switch (o) {
  9178. case"update":
  9179. var J = G.grid.getrowid(H);
  9180. if (K == h._changedrecords.length - 1) {G.grid.updaterow(J, I);} else {G.grid.updaterow(J, I, false);}
  9181. G.grid._updateFromAdapter = false;
  9182. return;
  9183. case"add":
  9184. G.grid.addrow(null, I);
  9185. G.grid._updateFromAdapter = false;
  9186. return;
  9187. case"remove":
  9188. var J = G.grid.getrowid(H);
  9189. x.push(J);
  9190. return;
  9191. }
  9192. });
  9193. if (x.length > 0) {
  9194. G.grid.deleterow(x, false);
  9195. G.grid._updateFromAdapter = false;
  9196. }
  9197. }
  9198. if (o == "update") {return;}
  9199. }
  9200. var m = G.totalrecords;
  9201. B(G, o);
  9202. if (y.localdata.notifier === null && y.localdata.name == "observableArray") {
  9203. y.localdata.notifier = function (L) {
  9204. if (this._updating) {return;}
  9205. this._updating = true;
  9206. var K = G.grid.getrowid(L.index);
  9207. switch (L.type) {
  9208. case"add":
  9209. var H = b.extend({}, L.object[L.index]);
  9210. var J = h.getid(y.id, H, L.index);
  9211. if (L.index === 0) {G.grid.addrow(J, H, "first");} else {G.grid.addrow(J, H);}
  9212. break;
  9213. case"delete":
  9214. G.grid.deleterow(K);
  9215. break;
  9216. case"update":
  9217. if (L.path && L.path.split(".").length > 1) {
  9218. var I = L.path.split(".");
  9219. G.grid.setcellvalue(L.index, I[I.length - 1], L.newValue);
  9220. } else {
  9221. var H = b.extend({}, L.object[L.index]);
  9222. G.grid.updaterow(K, H);
  9223. }
  9224. break;
  9225. }
  9226. this._updating = false;
  9227. };
  9228. }
  9229. if (o == "updateData") {
  9230. G.refresh();
  9231. G.grid._updateGridData();
  9232. } else {
  9233. if (y.recordstartindex && this.virtualmode) {G.updateview(y.recordstartindex, y.recordstartindex + G.pagesize);} else {G.refresh();}
  9234. G.update(m != G.totalrecords);
  9235. }
  9236. };
  9237. n();
  9238. h.bindBindingUpdate(G.grid.element.id, n);
  9239. }
  9240. break;
  9241. case"json":
  9242. case"jsonp":
  9243. case"xml":
  9244. case"xhtml":
  9245. case"script":
  9246. case"text":
  9247. case"csv":
  9248. case"tab":
  9249. if (y.localdata != null) {
  9250. h.unbindBindingUpdate(G.grid.element.id);
  9251. if ((!G.grid.autobind && G.grid.isInitialized) || G.grid.autobind) {h.dataBind();}
  9252. var n = function (o) {
  9253. var m = G.totalrecords;
  9254. B(G);
  9255. if (o == "updateData") {
  9256. G.refresh();
  9257. G.grid._updateGridData();
  9258. } else {
  9259. if (y.recordstartindex && G.virtualmode) {G.updateview(y.recordstartindex, y.recordstartindex + G.pagesize);} else {G.refresh();}
  9260. G.update(m != G.totalrecords);
  9261. }
  9262. };
  9263. n();
  9264. h.bindBindingUpdate(G.grid.element.id, n);
  9265. return;
  9266. }
  9267. var D = {};
  9268. var C = [];
  9269. var v = 0;
  9270. var E = {};
  9271. for (var j = 0; j < this.filters.length; j++) {
  9272. var g = this.filters[j].datafield;
  9273. var l = this.filters[j].filter;
  9274. if (!l.getfilters) {continue;}
  9275. var i = l.getfilters();
  9276. E[g + "operator"] = l.operator;
  9277. for (var A = 0; A < i.length; A++) {
  9278. i[A].datafield = g;
  9279. var u = i[A].value;
  9280. if (i[A].type == "datefilter") {
  9281. if (i[A].value && i[A].value.toLocaleString) {
  9282. var d = this.grid.getcolumn(i[A].datafield);
  9283. if (d && d.cellsformat) {
  9284. var z = this.grid.source.formatDate(i[A].value, d.cellsformat, this.grid.gridlocalization);
  9285. if (z) {E["filtervalue" + v] = z;} else {E["filtervalue" + v] = i[A].value.toLocaleString();}
  9286. } else {E["filtervalue" + v] = u.toString();}
  9287. } else {E["filtervalue" + v] = u.toString();}
  9288. } else {
  9289. E["filtervalue" + v] = u.toString();
  9290. if (i[A].data) {E["filterid" + v] = i[A].data.toString();}
  9291. if (i[A].id) {E["filterid" + v] = i[A].id.toString();}
  9292. }
  9293. E["filtercondition" + v] = i[A].condition;
  9294. E["filteroperator" + v] = i[A].operator;
  9295. E["filterdatafield" + v] = g;
  9296. var t = { label: u.toString() };
  9297. if (i[A].data) {t.value = i[A].data.toString();}
  9298. if (i[A].id) {t.value = i[A].id.toString();} else {t.value = u.toString();}
  9299. t.condition = i[A].condition;
  9300. t.operator = i[A].operator == 0 ? "and" : "or";
  9301. t.field = g;
  9302. t.type = i[A].type;
  9303. var e = false;
  9304. if (C.length > 0) {
  9305. for (var s = 0; s < C.length; s++) {
  9306. var r = C[s];
  9307. if (r.field == g) {
  9308. r.filters.push(t);
  9309. e = true;
  9310. break;
  9311. }
  9312. }
  9313. }
  9314. if (!e) {
  9315. C.push({ field: g, filters: [] });
  9316. C[C.length - 1].filters.push(t);
  9317. }
  9318. v++;
  9319. }
  9320. }
  9321. E.filterGroups = C;
  9322. E.filterscount = v;
  9323. E.groupscount = G.groups.length;
  9324. for (var j = 0; j < G.groups.length; j++) {E["group" + j] = G.groups[j];}
  9325. if (y.recordstartindex == undefined) {y.recordstartindex = 0;}
  9326. if (y.recordendindex == undefined || y.recordendindex == 0) {
  9327. if (G.grid.height && G.grid.height.toString().indexOf("%") == -1) {
  9328. y.recordendindex = parseInt(G.grid.height) / G.grid.rowsheight;
  9329. y.recordendindex += 2;
  9330. y.recordendindex = parseInt(y.recordendindex);
  9331. } else {
  9332. y.recordendindex = b(window).height() / G.grid.rowsheight;
  9333. y.recordendindex = parseInt(y.recordendindex);
  9334. }
  9335. if (this.pageable) {y.recordendindex = this.pagesize;}
  9336. }
  9337. if (this.pageable) {
  9338. y.recordstartindex = (this.pagenum) * this.pagesize;
  9339. y.recordendindex = (this.pagenum + 1) * this.pagesize;
  9340. }
  9341. b.extend(E, { sortdatafield: G.sortfield, sortorder: G.sortfielddirection, pagenum: G.pagenum, pagesize: G.grid.pagesize, recordstartindex: y.recordstartindex, recordendindex: y.recordendindex });
  9342. var F = h._options.data;
  9343. if (h._options.data) {b.extend(h._options.data, E);} else {
  9344. if (y.data) {b.extend(E, y.data);}
  9345. h._options.data = E;
  9346. }
  9347. var n = function () {
  9348. var o = b.jqx.browser.msie && b.jqx.browser.version < 9;
  9349. var q = function () {
  9350. var x = G.totalrecords;
  9351. B(G);
  9352. if (y.recordstartindex && G.virtualmode) {G.updateview(y.recordstartindex, y.recordstartindex + G.pagesize);} else {G.refresh();}
  9353. G.update(x != G.totalrecords);
  9354. };
  9355. if (o) {try {q();} catch (m) {}} else {q();}
  9356. };
  9357. h.unbindDownloadComplete(G.grid.element.id);
  9358. h.bindDownloadComplete(G.grid.element.id, n);
  9359. if ((!G.grid.autobind && G.grid.isInitialized) || G.grid.autobind) {h.dataBind();} else {if (!G.grid.isInitialized && !G.grid.autobind) {n();}}
  9360. h._options.data = F;
  9361. }
  9362. };
  9363. this.getid = function (g, e, f) {
  9364. if (b(g, e).length > 0) {return b(g, e).text();}
  9365. if (g) {
  9366. if (g.toString().length > 0) {
  9367. var d = b(e).attr(g);
  9368. if (d != null && d.toString().length > 0) {return d;}
  9369. }
  9370. }
  9371. return f;
  9372. };
  9373. this.getvaluebytype = function (g, d) {
  9374. var e = g;
  9375. if (d.type == "date") {
  9376. var f = new Date(g);
  9377. if (f.toString() == "NaN" || f.toString() == "Invalid Date") {if (b.jqx.dataFormat) {g = b.jqx.dataFormat.tryparsedate(g);} else {g = f;}} else {g = f;}
  9378. if (g == null) {g = e;}
  9379. } else {
  9380. if (d.type == "float") {
  9381. var g = parseFloat(g);
  9382. if (isNaN(g)) {g = e;}
  9383. } else {
  9384. if (d.type == "int") {
  9385. var g = parseInt(g);
  9386. if (isNaN(g)) {g = e;}
  9387. } else {
  9388. if (d.type == "bool") {
  9389. if (g != null) {if (g.toLowerCase() == "false") {g = false;} else {if (g.toLowerCase() == "true") {g = true;}}}
  9390. if (g == 1) {g = true;} else {if (g == 0) {g = false;} else {g = "";}}
  9391. }
  9392. }
  9393. }
  9394. }
  9395. return g;
  9396. };
  9397. this.setpaging = function (d) {
  9398. if (d.pageSize != undefined) {this.pagesize = d.pageSize;}
  9399. if (d.pageNum != undefined) {this.pagenum = Math.min(d.pageNum, Math.ceil(this.totalrows / this.pagesize));}
  9400. this.refresh();
  9401. };
  9402. this.getpagingdetails = function () {return { pageSize: this.pagesize, pageNum: this.pagenum, totalrows: this.totalrows };};
  9403. this._clearcaches = function () {
  9404. this.sortcache = {};
  9405. this.sortdata = null;
  9406. this.changedrecords = new Array();
  9407. this.records = new Array();
  9408. this.rows = new Array();
  9409. this.cacheddata = new Array();
  9410. this.originaldata = new Array();
  9411. this.bounditems = new Array();
  9412. this.loadedrecords = new Array();
  9413. this.loadedrootgroups = new Array();
  9414. this.loadedgroups = new Array();
  9415. this.loadedgroupsByKey = new Array();
  9416. this._cachegrouppages = new Array();
  9417. this.recordsbyid = new Array();
  9418. this.cachedrecords = new Array();
  9419. this.recordids = new Array();
  9420. };
  9421. this.addfilter = function (g, f) {
  9422. var e = -1;
  9423. for (var d = 0; d < this.filters.length; d++) {
  9424. if (this.filters[d].datafield == g) {
  9425. e = d;
  9426. break;
  9427. }
  9428. }
  9429. if (e == -1) {this.filters[this.filters.length] = { filter: f, datafield: g };} else {this.filters[e] = { filter: f, datafield: g };}
  9430. };
  9431. this.removefilter = function (e) {
  9432. for (var d = 0; d < this.filters.length; d++) {
  9433. if (this.filters[d].datafield == e) {
  9434. this.filters.splice(d, 1);
  9435. break;
  9436. }
  9437. }
  9438. };
  9439. this.getItemFromIndex = function (d) {return this.records[d];};
  9440. this.updaterow = function (d, n, l) {
  9441. var e = this.filters && this.filters.length > 0 && !this.virtualmode;
  9442. if (!e && n != undefined && d != undefined) {
  9443. n.uid = d;
  9444. if (!(n[this.source.id])) {n[this.source.id] = n.uid;}
  9445. var j = this.recordsbyid["id" + d];
  9446. var k = this.records.indexOf(j);
  9447. if (k == -1) {return false;}
  9448. this.records[k] = n;
  9449. if (this.cachedrecords) {this.cachedrecords[k] = n;}
  9450. if (l == true || l == undefined) {this.refresh();}
  9451. this.changedrecords[n.uid] = { Type: "Update", OldData: j, Data: n };
  9452. return true;
  9453. } else {
  9454. if (this.filters && this.filters.length > 0) {
  9455. var f = this.cachedrecords;
  9456. var j = null;
  9457. var k = -1;
  9458. for (var h = 0; h < f.length; h++) {
  9459. if (f[h].uid == d) {
  9460. j = f[h];
  9461. k = h;
  9462. break;
  9463. }
  9464. }
  9465. if (j) {
  9466. var m = this.that;
  9467. for (var g in n) {m.cachedrecords[k][g] = n[g];}
  9468. if (l == true || l == undefined) {this.refresh();}
  9469. return true;
  9470. }
  9471. }
  9472. }
  9473. return false;
  9474. };
  9475. this.addrow = function (h, i, d, g) {
  9476. if (i != undefined) {
  9477. if (b.isEmptyObject(i)) {
  9478. if (this.source && this.source.datafields) {
  9479. b.each(this.source.datafields, function () {
  9480. var j = "";
  9481. if (this.type == "number") {j = null;}
  9482. if (this.type == "date") {j = null;}
  9483. if (this.type == "bool" || this.type == "boolean") {j = false;}
  9484. i[this.name] = j;
  9485. });
  9486. }
  9487. }
  9488. if (!h || this.recordsbyid["id" + h]) {
  9489. i.uid = this.getid(this.source.id, i, this.totalrecords);
  9490. var e = this.recordsbyid["id" + i.uid];
  9491. while (e != null) {
  9492. var f = Math.floor(Math.random() * 10000).toString();
  9493. i.uid = f;
  9494. e = this.recordsbyid["id" + f];
  9495. }
  9496. } else {i.uid = h;}
  9497. if (!(i[this.source.id])) {if (this.source.id != undefined) {i[this.source.id] = i.uid;}}
  9498. if (d == "last") {this.records.push(i);} else {if (typeof d === "number" && isFinite(d)) {this.records.splice(d, 0, i);} else {this.records.splice(0, 0, i);}}
  9499. if (this.filters && this.filters.length > 0) {if (d == "last") {this.cachedrecords.push(i);} else {if (typeof d === "number" && isFinite(d)) {this.cachedrecords.splice(d, 0, i);} else {this.cachedrecords.splice(0, 0, i);}}}
  9500. this.totalrecords++;
  9501. if (this.virtualmode) {this.source.totalrecords = this.totalrecords;}
  9502. if (g == true || g == undefined) {this.refresh();}
  9503. this.changedrecords[i.uid] = { Type: "New", Data: i };
  9504. return true;
  9505. }
  9506. return false;
  9507. };
  9508. this.deleterow = function (j, h) {
  9509. if (j != undefined) {
  9510. var d = this.filters && this.filters.length > 0;
  9511. if (this.recordsbyid["id" + j] && !d) {
  9512. var e = this.recordsbyid["id" + j];
  9513. var k = this.records.indexOf(e);
  9514. if (this.grid && this.grid.sortable && this.grid.sortmode == "many") {
  9515. for (var g = 0; g < this.records.length; g++) {
  9516. if (this.records[g].boundindex === e.boundindex) {
  9517. k = g;
  9518. break;
  9519. }
  9520. }
  9521. }
  9522. this.changedrecords[j] = { Type: "Delete", Data: this.records[k] };
  9523. this.records.splice(k, 1);
  9524. this.totalrecords--;
  9525. if (this.virtualmode) {this.source.totalrecords = this.totalrecords;}
  9526. if (h == true || h == undefined) {this.refresh();}
  9527. return true;
  9528. } else {
  9529. if (this.filters && this.filters.length > 0) {
  9530. var f = this.cachedrecords;
  9531. var e = null;
  9532. var k = -1;
  9533. for (var g = 0; g < f.length; g++) {
  9534. if (f[g].uid == j) {
  9535. e = f[g];
  9536. k = g;
  9537. break;
  9538. }
  9539. }
  9540. if (e) {
  9541. this.cachedrecords.splice(k, 1);
  9542. if (h == true || h == undefined) {
  9543. this.totalrecords = 0;
  9544. this.records = this.cachedrecords;
  9545. this.refresh();
  9546. }
  9547. return true;
  9548. }
  9549. }
  9550. }
  9551. return false;
  9552. }
  9553. return false;
  9554. };
  9555. this.reload = function (f, d, r, g, h, u, t) {
  9556. var m = this.that;
  9557. var l = new Array();
  9558. var o = f;
  9559. var i = d;
  9560. var j = r;
  9561. var p = g;
  9562. var k = i.length;
  9563. var w = 0;
  9564. var e = 0;
  9565. var s, n;
  9566. this.columns = [];
  9567. this.bounditems = new Array();
  9568. this.loadedrecords = new Array();
  9569. this.loadedrootgroups = new Array();
  9570. this.loadedgroups = new Array();
  9571. this.loadedgroupsByKey = new Array();
  9572. this._cachegrouppages = new Array();
  9573. this.recordsbyid = {};
  9574. if (this.totalrecords == 0) {
  9575. Object.size = function (z) {
  9576. var y = 0, x;
  9577. for (x in z) {if (z.hasOwnProperty(x)) {y++;}}
  9578. return y;
  9579. };
  9580. var v = Object.size(o);
  9581. this.totalrecords = v;
  9582. b.each(this.records, function (y) {
  9583. var z = this;
  9584. var x = 0;
  9585. b.each(z, function (A, B) {m.columns[x++] = A;});
  9586. return false;
  9587. });
  9588. }
  9589. if (this.virtualmode) {
  9590. if (this.pageable) {
  9591. this.updateview();
  9592. return;
  9593. }
  9594. var u = 0;
  9595. if (!this.groupable) {
  9596. this.updateview();
  9597. return;
  9598. } else {var t = this.totalrecords;}
  9599. } else {
  9600. var u = 0;
  9601. var t = this.totalrecords;
  9602. }
  9603. if (this.groupable && this.groups.length > 0 && this.loadgrouprecords) {
  9604. var q = u;
  9605. q = this.loadgrouprecords(0, u, t, j, e, p, i, k, l);
  9606. } else {w = this.loadflatrecords(u, t, j, e, p, i, k, l);}
  9607. if (k > e) {i.splice(e, k - e);}
  9608. if (this.groups.length > 0 && this.groupable) {this.totalrows = q;} else {this.totalrows = w;}
  9609. return l;
  9610. };
  9611. this.loadflatrecords = function (u, r, h, d, p, g, j, l) {
  9612. var m = this.that;
  9613. var o = u;
  9614. var v = u;
  9615. r = Math.min(r, this.totalrecords);
  9616. var f = this.sortdata != null;
  9617. var s = this.source.id && (this.source.datatype == "local" || this.source.datatype == "array" || this.source.datatype == "");
  9618. var t = f ? this.sortdata : this.records;
  9619. for (var k = u; k < r; k++) {
  9620. var q = {};
  9621. if (!f) {
  9622. q = new Object(t[k]);
  9623. var n = q[m.uniqueId];
  9624. q.boundindex = o;
  9625. m.loadedrecords[o] = q;
  9626. if (q.uid == undefined) {q.uid = m.getid(m.source.id, q, o);}
  9627. m.recordsbyid["id" + q.uid] = t[k];
  9628. q.uniqueid = m.generatekey();
  9629. m.bounditems[this.bounditems.length] = q;
  9630. } else {
  9631. q = b.extend({}, t[k].value);
  9632. var n = q[m.uniqueId];
  9633. q.boundindex = t[k].index;
  9634. if (q.uid == undefined) {q.uid = m.getid(m.source.id, q, q.boundindex);}
  9635. m.recordsbyid["id" + q.uid] = t[k].value;
  9636. m.loadedrecords[o] = q;
  9637. q.uniqueid = m.generatekey();
  9638. m.bounditems[q.boundindex] = q;
  9639. }
  9640. if (d >= j || n != g[d][m.uniqueId] || (p && p[n])) {l[l.length] = d;}
  9641. g[d] = q;
  9642. d++;
  9643. q.visibleindex = v;
  9644. v++;
  9645. o++;
  9646. }
  9647. if (m.grid.summaryrows) {
  9648. var e = o;
  9649. b.each(m.grid.summaryrows, function () {
  9650. var i = b.extend({}, this);
  9651. i.boundindex = r++;
  9652. m.loadedrecords[e] = i;
  9653. i.uniqueid = m.generatekey();
  9654. m.bounditems[m.bounditems.length] = i;
  9655. g[d] = i;
  9656. d++;
  9657. i.visibleindex = v;
  9658. v++;
  9659. e++;
  9660. });
  9661. }
  9662. return v;
  9663. }, this.updateview = function (o, p) {
  9664. var r = this.that;
  9665. var k = this.pagesize * this.pagenum;
  9666. var n = 0;
  9667. var s = new Array();
  9668. var e = this.filters;
  9669. var j = this.updated;
  9670. var l = s.length;
  9671. if (this.pageable) {
  9672. if (this.virtualmode) {
  9673. if (!this.groupable || this.groups.length == 0) {
  9674. this.loadflatrecords(this.pagesize * this.pagenum, this.pagesize * (1 + this.pagenum), e, n, j, s, l, []);
  9675. this.totalrows = s.length;
  9676. } else {
  9677. if (this.groupable && this.groups.length > 0 && this.loadgrouprecords) {
  9678. if (this._cachegrouppages[this.pagenum + "_" + this.pagesize] != undefined) {
  9679. this.rows = this._cachegrouppages[this.pagenum + "_" + this.pagesize];
  9680. this.totalrows = this.rows.length;
  9681. return;
  9682. }
  9683. var m = this.pagesize * (1 + this.pagenum);
  9684. if (m > this.totalrecords) {m = this.totalrecords;}
  9685. this.loadgrouprecords(0, this.pagesize * this.pagenum, m, e, n, j, s, l, []);
  9686. this._cachegrouppages[this.pagenum + "_" + this.pagesize] = this.rows;
  9687. this.totalrows = this.rows.length;
  9688. return;
  9689. }
  9690. }
  9691. }
  9692. } else {
  9693. if (this.virtualmode && (!this.groupable || this.groups.length == 0)) {
  9694. var g = this.pagesize;
  9695. if (g == 0) {g = Math.min(100, this.totalrecords);}
  9696. var d = g * this.pagenum;
  9697. if (this.loadedrecords.length == 0) {d = 0;}
  9698. if (o != null && p != null) {this.loadflatrecords(o, p, e, n, j, s, l, []);} else {this.loadflatrecords(this.pagesize * this.pagenum, this.pagesize * (1 + this.pagenum), e, n, j, s, l, []);}
  9699. this.totalrows = this.loadedrecords.length;
  9700. this.rows = s;
  9701. if (s.length >= g) {return;}
  9702. }
  9703. }
  9704. if (this.groupable && this.pageable && this.groups.length > 0 && this._updategroupsinpage) {s = this._updategroupsinpage(r, e, k, n, l, this.pagesize * this.pagenum, this.pagesize * (1 + this.pagenum));} else {
  9705. for (var h = this.pagesize * this.pagenum; h < this.pagesize * (1 + this.pagenum); h++) {
  9706. var q = h < this.loadedrecords.length ? this.loadedrecords[h] : null;
  9707. if (q == null) {continue;}
  9708. if (!this.pagesize || (k >= this.pagesize * this.pagenum && k <= this.pagesize * (this.pagenum + 1))) {
  9709. s[n] = q;
  9710. n++;
  9711. }
  9712. k++;
  9713. }
  9714. }
  9715. if ((s.length == 0 || s.length < this.pagesize) && !this.pageable && this.virtualmode) {
  9716. n = s.length;
  9717. var f = s.length;
  9718. for (var h = this.pagesize * this.pagenum; h < this.pagesize * (1 + this.pagenum) - f; h++) {
  9719. var q = {};
  9720. q.boundindex = h + f;
  9721. q.visibleindex = h + f;
  9722. q.uniqueid = r.generatekey();
  9723. q.empty = true;
  9724. r.bounditems[h + f] = q;
  9725. s[n] = q;
  9726. n++;
  9727. }
  9728. }
  9729. this.rows = s;
  9730. };
  9731. this.generatekey = function () {
  9732. var d = function () {return (((1 + Math.random()) * 16) | 0);};
  9733. return ("" + d() + d() + "-" + d() + "-" + d() + "-" + d() + "-" + d() + d() + d());
  9734. };
  9735. this.reloaddata = function () {this.reload(this.records, this.rows, this.filter, this.updated, true);};
  9736. this.refresh = function (m) {
  9737. if (this.suspend) {return;}
  9738. if (m == undefined) {m = true;}
  9739. var g = this.rows.length;
  9740. var B = this.totalrows;
  9741. if (this.filters.length > 0 && !this.virtualmode) {
  9742. var q = "";
  9743. var f = this.cachedrecords.length;
  9744. var k = new Array();
  9745. this.totalrecords = 0;
  9746. var A = this.cachedrecords;
  9747. this._dataIndexToBoundIndex = new Array();
  9748. var s = this.filters.length;
  9749. if (this.source != null && this.source.filter != undefined && this.source.localdata != undefined) {
  9750. k = this.source.filter(this.filters, A, f);
  9751. if (k == undefined) {k = new Array();}
  9752. this.records = k;
  9753. } else {
  9754. if (this.source.filter == null || this.source.filter == undefined) {
  9755. for (var l = 0; l < f; l++) {
  9756. var h = A[l];
  9757. var w = undefined;
  9758. for (var v = 0; v < s; v++) {
  9759. var q = this.filters[v].filter;
  9760. var t = h[this.filters[v].datafield];
  9761. var p = q.evaluate(t);
  9762. if (this.grid.filter) {
  9763. var z = this.grid.filter(t, h, this.filters[v].datafield, q, p);
  9764. if (z !== undefined) {p = z;}
  9765. }
  9766. if (w == undefined) {w = p;} else {if (q.operator == "or") {w = w || p;} else {w = w && p;}}
  9767. }
  9768. if (w) {
  9769. k[k.length] = b.extend({ dataindex: l }, h);
  9770. this._dataIndexToBoundIndex[l] = { boundindex: k.length - 1 };
  9771. } else {this._dataIndexToBoundIndex[l] = null;}
  9772. }
  9773. this.records = k;
  9774. }
  9775. }
  9776. if (this.sortdata) {
  9777. if (this.grid && this.grid.sortmode !== "many") {
  9778. var e = this.sortfield;
  9779. if (this.sortcache[e]) {
  9780. this.sortdata = null;
  9781. var y = this.sortcache[e].direction;
  9782. this.sortcache[e] = null;
  9783. this.sortby(this.sortfield, y);
  9784. return;
  9785. }
  9786. } else {
  9787. var d = this.grid.getsortcolumns();
  9788. for (var x = 0; x < d.length; x++) {
  9789. var o = d[x];
  9790. var u = o.dataField;
  9791. this.grid.sortby(u, o.ascending, null);
  9792. }
  9793. return;
  9794. }
  9795. }
  9796. } else {
  9797. if (this.filters.length == 0 && !this.virtualmode) {
  9798. if (this.cachedrecords) {
  9799. this.totalrecords = 0;
  9800. var A = this.cachedrecords;
  9801. this.records = A;
  9802. if (this.sortdata) {
  9803. if (this.grid && this.grid.sortmode !== "many") {
  9804. var e = this.sortfield;
  9805. if (this.sortcache[e]) {
  9806. this.sortdata = null;
  9807. var y = this.sortcache[e].direction;
  9808. this.sortcache[e] = null;
  9809. this.sortby(this.sortfield, y);
  9810. return;
  9811. }
  9812. } else {
  9813. var d = this.grid.getsortcolumns();
  9814. for (var x = 0; x < d.length; x++) {
  9815. var o = d[x];
  9816. var u = o.dataField;
  9817. this.grid.sortby(u, o.ascending, null);
  9818. }
  9819. return;
  9820. }
  9821. }
  9822. }
  9823. }
  9824. }
  9825. var r = this.reload(this.records, this.rows, this.filter, this.updated, m);
  9826. this.updated = null;
  9827. if (this.rowschangecallback != null) {
  9828. var n = this.rows;
  9829. if (B != this.totalrows) {this.rowschangecallback({ type: "PagingChanged", data: this.getpagingdetails() });}
  9830. if (g != n.length) {this.rowschangecallback({ type: "RowsCountChanged", data: { previous: g, current: n.length } });}
  9831. if (r.length > 0 || g != n.length) {this.rowschangecallback({ type: "RowsChanged", data: { previous: g, current: n.length, diff: r } });}
  9832. }
  9833. };
  9834. return this;
  9835. };
  9836. })(jqxBaseFramework);