Produced by Araxis Merge on 5/9/2017 12:03:04 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Tue May 9 16:03:04 2017 UTC | ||
| 2 | OSCIF_HEC_v1.4_Sprint23_build4_Apr_2017.zip\CRM_solutions\Managed\North52BPA_1_0_0_506_managed_2013_2015_2016..zip\WebResources | north52_javascriptsdk_jquery2DFD45C7-C243-E111-B3AF-00155DF5B00D | Mon Sep 19 18:20:18 2016 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 395 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | if (typeof (SDK) == "undefined ") | |||||
| 2 | { SDK = { __namespac e: true }; } | |||||
| 3 | SDK.JQuery = { | |||||
| 4 | _context: function () { | |||||
| 5 | ///<summ ary> | |||||
| 6 | /// Priv ate functi on to the context ob ject. | |||||
| 7 | ///</sum mary> | |||||
| 8 | ///<retu rns>Contex t</returns > | |||||
| 9 | if (type of GetGlob alContext != "undefi ned") | |||||
| 10 | { return GetGlobal Context(); } | |||||
| 11 | else { | |||||
| 12 | if (typ eof Xrm != "undefine d") { | |||||
| 13 | return Xrm.Page. context; | |||||
| 14 | } | |||||
| 15 | else | |||||
| 16 | { throw new Error ("Context is not ava ilable."); } | |||||
| 17 | } | |||||
| 18 | }, | |||||
| 19 | _getServe rUrl: func tion () { | |||||
| 20 | ||||||
| 21 | var ur l = "unkno wn"; | |||||
| 22 | ||||||
| 23 | if (typ eof this._ context(). getServerU rl != "und efined") { | |||||
| 24 | u rl = this. _context() .getServer Url(); | |||||
| 25 | u rl = url . replace(/^ (http|http s):\/\/([_ a-zA-Z0-9\ -\.]+)(:([ 0-9]{1,5}) )?/, windo w.location .protocol + "//" + w indow.loca tion.host) ; | |||||
| 26 | u rl = url . replace(/\ /$/, ""); | |||||
| 27 | } | |||||
| 28 | ||||||
| 29 | if (type of this._c ontext().g etClientUr l != "unde fined") { | |||||
| 30 | url = t his._conte xt().getCl ientUrl(); | |||||
| 31 | } | |||||
| 32 | return u rl; | |||||
| 33 | ||||||
| 34 | }, | |||||
| 35 | _ODataPat h: functio n () { | |||||
| 36 | ///<summ ary> | |||||
| 37 | /// Priv ate functi on to retu rn the pat h to the R EST endpoi nt. | |||||
| 38 | ///</sum mary> | |||||
| 39 | ///<retu rns>String </returns> | |||||
| 40 | return t his._getSe rverUrl() + "/XRMSer vices/2011 /Organizat ionData.sv c/"; | |||||
| 41 | }, | |||||
| 42 | _errorHan dler: func tion (req) { | |||||
| 43 | ///<summ ary> | |||||
| 44 | /// Priv ate functi on return an Error o bject to t he errorCa llback | |||||
| 45 | ///</sum mary> | |||||
| 46 | ///<para m name="re q" type="X MLHttpRequ est"> | |||||
| 47 | /// The XMLHttpReq uest respo nse that r eturned an error. | |||||
| 48 | ///</par am> | |||||
| 49 | ///<retu rns>Error< /returns> | |||||
| 50 | return n ew Error(" Error : " + | |||||
| 51 | re q.status + ": " + | |||||
| 52 | re q.statusTe xt + ": " + | |||||
| 53 | JS ON.parse(r eq.respons eText).err or.message .value); | |||||
| 54 | }, | |||||
| 55 | _dateRevi ver: funct ion (key, value) { | |||||
| 56 | ///<summ ary> | |||||
| 57 | /// Priv ate functi on to conv ert matchi ng string values to Date objec ts. | |||||
| 58 | ///</sum mary> | |||||
| 59 | ///<para m name="ke y" type="S tring"> | |||||
| 60 | /// The key used t o identify the objec t property | |||||
| 61 | ///</par am> | |||||
| 62 | ///<para m name="va lue" type= "String"> | |||||
| 63 | /// The string val ue represe nting a da te | |||||
| 64 | ///</par am> | |||||
| 65 | var a; | |||||
| 66 | if (type of value = == 'string ') { | |||||
| 67 | a = /Da te\(([-+]? \d+)\)/.ex ec(value); | |||||
| 68 | if (a) { | |||||
| 69 | return new Date( parseInt(v alue.repla ce("/Date( ", "").rep lace(")/", ""), 10)) ; | |||||
| 70 | } | |||||
| 71 | } | |||||
| 72 | return v alue; | |||||
| 73 | }, | |||||
| 74 | _paramete rCheck: fu nction (pa rameter, m essage) { | |||||
| 75 | ///<summ ary> | |||||
| 76 | /// Priv ate functi on used to check whe ther requi red parame ters are n ull or und efined | |||||
| 77 | ///</sum mary> | |||||
| 78 | ///<para m name="pa rameter" t ype="Objec t"> | |||||
| 79 | /// The parameter to check; | |||||
| 80 | ///</par am> | |||||
| 81 | ///<para m name="me ssage" typ e="String" > | |||||
| 82 | /// The error mess age text t o include when the e rror is th rown. | |||||
| 83 | ///</par am> | |||||
| 84 | if ((typ eof parame ter === "u ndefined") || parame ter === nu ll) { | |||||
| 85 | throw n ew Error(m essage); | |||||
| 86 | } | |||||
| 87 | }, | |||||
| 88 | _stringPa rameterChe ck: functi on (parame ter, messa ge) { | |||||
| 89 | ///<summ ary> | |||||
| 90 | /// Priv ate functi on used to check whe ther requi red parame ters are n ull or und efined | |||||
| 91 | ///</sum mary> | |||||
| 92 | ///<para m name="pa rameter" t ype="Strin g"> | |||||
| 93 | /// The string par ameter to check; | |||||
| 94 | ///</par am> | |||||
| 95 | ///<para m name="me ssage" typ e="String" > | |||||
| 96 | /// The error mess age text t o include when the e rror is th rown. | |||||
| 97 | ///</par am> | |||||
| 98 | if (type of paramet er != "str ing") { | |||||
| 99 | throw n ew Error(m essage); | |||||
| 100 | } | |||||
| 101 | }, | |||||
| 102 | _callback ParameterC heck: func tion (call backParame ter, messa ge) { | |||||
| 103 | ///<summ ary> | |||||
| 104 | /// Priv ate functi on used to check whe ther requi red callba ck paramet ers are fu nctions | |||||
| 105 | ///</sum mary> | |||||
| 106 | ///<para m name="ca llbackPara meter" typ e="Functio n"> | |||||
| 107 | /// The callback p arameter t o check; | |||||
| 108 | ///</par am> | |||||
| 109 | ///<para m name="me ssage" typ e="String" > | |||||
| 110 | /// The error mess age text t o include when the e rror is th rown. | |||||
| 111 | ///</par am> | |||||
| 112 | if (type of callbac kParameter != "funct ion") { | |||||
| 113 | throw n ew Error(m essage); | |||||
| 114 | } | |||||
| 115 | }, | |||||
| 116 | createRec ord: funct ion (objec t, type, s uccessCall back, erro rCallback) { | |||||
| 117 | ///<summ ary> | |||||
| 118 | /// Send s an async hronous re quest to c reate a ne w record. | |||||
| 119 | ///</sum mary> | |||||
| 120 | ///<para m name="ob ject" type ="Object"> | |||||
| 121 | /// A Ja vaScript o bject with propertie s correspo nding to t he Schema name of | |||||
| 122 | /// enti ty attribu tes that a re valid f or create operations . | |||||
| 123 | ///</par am> | |||||
| 124 | this._pa rameterChe ck(object, "SDK.JQue ry.createR ecord requ ires the o bject para meter."); | |||||
| 125 | ///<para m name="ty pe" type=" String"> | |||||
| 126 | /// The Schema Nam e of the E ntity type record to create. | |||||
| 127 | /// For an Account record, u se "Accoun t" | |||||
| 128 | ///</par am> | |||||
| 129 | this._st ringParame terCheck(t ype, "SDK. JQuery.cre ateRecord requires t he type pa rameter is a string. "); | |||||
| 130 | ///<para m name="su ccessCallb ack" type= "Function" > | |||||
| 131 | /// The function t hat will b e passed t hrough and be called by a succ essful res ponse. | |||||
| 132 | /// This function can accept the retur ned record as a para meter. | |||||
| 133 | /// </pa ram> | |||||
| 134 | this._ca llbackPara meterCheck (successCa llback, "S DK.JQuery. createReco rd require s the succ essCallbac k is a fun ction."); | |||||
| 135 | ///<para m name="er rorCallbac k" type="F unction"> | |||||
| 136 | /// The function t hat will b e passed t hrough and be called by a fail ed respons e. | |||||
| 137 | /// This function must accep t an Error object as a paramet er. | |||||
| 138 | /// </pa ram> | |||||
| 139 | this._ca llbackPara meterCheck (errorCall back, "SDK .JQuery.cr eateRecord requires the errorC allback is a functio n."); | |||||
| 140 | ||||||
| 141 | var json Entity = w indow.JSON .stringify (object); | |||||
| 142 | ||||||
| 143 | $.ajax({ type: "PO ST", | |||||
| 144 | content Type: "app lication/j son; chars et=utf-8", | |||||
| 145 | datatyp e: "json", | |||||
| 146 | url: th is._ODataP ath() + ty pe + "Set" , | |||||
| 147 | data: j sonEntity, | |||||
| 148 | beforeS end: funct ion (xhr) { | |||||
| 149 | //Spec ifying thi s header e nsures tha t the resu lts will b e returned as JSON. | |||||
| 150 | xhr.se tRequestHe ader("Acce pt", "appl ication/js on"); | |||||
| 151 | }, | |||||
| 152 | success : function (data, te xtStatus, xhr) { | |||||
| 153 | succes sCallback( data.d); | |||||
| 154 | }, | |||||
| 155 | error: function ( xhr, textS tatus, err orThrown) { | |||||
| 156 | errorC allback(SD K.JQuery._ errorHandl er(xhr)); | |||||
| 157 | } | |||||
| 158 | }); | |||||
| 159 | }, | |||||
| 160 | retrieveR ecord: fun ction (id, type, sel ect, expan d, success Callback, errorCallb ack) { | |||||
| 161 | ///<summ ary> | |||||
| 162 | /// Send s an async hronous re quest to r etrieve a record. | |||||
| 163 | ///</sum mary> | |||||
| 164 | ///<para m name="id " type="St ring"> | |||||
| 165 | /// A St ring repre senting th e GUID val ue for the record to retrieve. | |||||
| 166 | ///</par am> | |||||
| 167 | this._st ringParame terCheck(i d, "SDK.JQ uery.retri eveRecord requires t he id para meter is a string.") ; | |||||
| 168 | ///<para m name="ty pe" type=" String"> | |||||
| 169 | /// The Schema Nam e of the E ntity type record to retrieve. | |||||
| 170 | /// For an Account record, u se "Accoun t" | |||||
| 171 | ///</par am> | |||||
| 172 | this._st ringParame terCheck(t ype, "SDK. JQuery.ret rieveRecor d requires the type parameter is a strin g."); | |||||
| 173 | ///<para m name="se lect" type ="String"> | |||||
| 174 | /// A St ring repre senting th e $select OData Syst em Query O ption to c ontrol whi ch | |||||
| 175 | /// attr ibutes wil l be retur ned. This is a comma separated list of A ttribute n ames that are valid for retrie ve. | |||||
| 176 | /// If n ull all pr operties f or the rec ord will b e returned | |||||
| 177 | ///</par am> | |||||
| 178 | if (sele ct != null ) | |||||
| 179 | this._s tringParam eterCheck( select, "S DK.JQuery. retrieveRe cord requi res the se lect param eter is a string."); | |||||
| 180 | ///<para m name="ex pand" type ="String"> | |||||
| 181 | /// A St ring repre senting th e $expand OData Syst em Query O ption valu e to contr ol which | |||||
| 182 | /// rela ted record s are also returned. This is a comma sep arated lis t of of up to 6 enti ty relatio nship name s | |||||
| 183 | /// If n ull no exp anded rela ted record s will be returned. | |||||
| 184 | ///</par am> | |||||
| 185 | if (expa nd != null ) | |||||
| 186 | this._s tringParam eterCheck( expand, "S DK.JQuery. retrieveRe cord requi res the ex pand param eter is a string."); | |||||
| 187 | ///<para m name="su ccessCallb ack" type= "Function" > | |||||
| 188 | /// The function t hat will b e passed t hrough and be called by a succ essful res ponse. | |||||
| 189 | /// This function must accep t the retu rned recor d as a par ameter. | |||||
| 190 | /// </pa ram> | |||||
| 191 | this._ca llbackPara meterCheck (successCa llback, "S DK.JQuery. retrieveRe cord requi res the su ccessCallb ack parame ter is a f unction.") ; | |||||
| 192 | ///<para m name="er rorCallbac k" type="F unction"> | |||||
| 193 | /// The function t hat will b e passed t hrough and be called by a fail ed respons e. | |||||
| 194 | /// This function must accep t an Error object as a paramet er. | |||||
| 195 | /// </pa ram> | |||||
| 196 | this._ca llbackPara meterCheck (errorCall back, "SDK .JQuery.re trieveReco rd require s the erro rCallback parameter is a funct ion."); | |||||
| 197 | ||||||
| 198 | var syst emQueryOpt ions = ""; | |||||
| 199 | ||||||
| 200 | if (sele ct != null || expand != null) { | |||||
| 201 | systemQ ueryOption s = "?"; | |||||
| 202 | if (sel ect != nul l) { | |||||
| 203 | var se lectString = "$selec t=" + sele ct; | |||||
| 204 | if (ex pand != nu ll) { | |||||
| 205 | selec tString = selectStri ng + "," + expand; | |||||
| 206 | } | |||||
| 207 | system QueryOptio ns = syste mQueryOpti ons + sele ctString; | |||||
| 208 | } | |||||
| 209 | if (exp and != nul l) { | |||||
| 210 | system QueryOptio ns = syste mQueryOpti ons + "&$e xpand=" + expand; | |||||
| 211 | } | |||||
| 212 | } | |||||
| 213 | ||||||
| 214 | $.ajax({ | |||||
| 215 | type: " GET", | |||||
| 216 | content Type: "app lication/j son; chars et=utf-8", | |||||
| 217 | datatyp e: "json", | |||||
| 218 | url: th is._ODataP ath() + ty pe + "Set" + "(guid' " + id + " ')" + syst emQueryOpt ions, | |||||
| 219 | beforeS end: funct ion (xhr) { | |||||
| 220 | //Spec ifying thi s header e nsures tha t the resu lts will b e returned as JSON. | |||||
| 221 | xhr.se tRequestHe ader("Acce pt", "appl ication/js on"); | |||||
| 222 | }, | |||||
| 223 | success : function (data, te xtStatus, xhr) { | |||||
| 224 | //JQue ry does no t provide an opportu nity to sp ecify a da te reviver so this c ode | |||||
| 225 | // pars es the xhr .responseT ext rather than use the data p arameter p assed by J Query. | |||||
| 226 | succes sCallback( JSON.parse (xhr.respo nseText, S DK.JQuery. _dateReviv er).d); | |||||
| 227 | }, | |||||
| 228 | error: function ( xhr, textS tatus, err orThrown) { | |||||
| 229 | errorC allback(SD K.JQuery._ errorHandl er(xhr)); | |||||
| 230 | } | |||||
| 231 | }); | |||||
| 232 | }, | |||||
| 233 | updateRec ord: funct ion (id, o bject, typ e, success Callback, errorCallb ack) { | |||||
| 234 | ///<summ ary> | |||||
| 235 | /// Send s an async hronous re quest to u pdate a re cord. | |||||
| 236 | ///</sum mary> | |||||
| 237 | ///<para m name="id " type="St ring"> | |||||
| 238 | /// A St ring repre senting th e GUID val ue for the record to retrieve. | |||||
| 239 | ///</par am> | |||||
| 240 | this._st ringParame terCheck(i d, "SDK.JQ uery.updat eRecord re quires the id parame ter."); | |||||
| 241 | ///<para m name="ob ject" type ="Object"> | |||||
| 242 | /// A Ja vaScript o bject with propertie s correspo nding to t he Schema Names for | |||||
| 243 | /// enti ty attribu tes that a re valid f or update operations . | |||||
| 244 | ///</par am> | |||||
| 245 | this._pa rameterChe ck(object, "SDK.JQue ry.updateR ecord requ ires the o bject para meter."); | |||||
| 246 | ///<para m name="ty pe" type=" String"> | |||||
| 247 | /// The Schema Nam e of the E ntity type record to retrieve. | |||||
| 248 | /// For an Account record, u se "Accoun t" | |||||
| 249 | ///</par am> | |||||
| 250 | this._st ringParame terCheck(t ype, "SDK. JQuery.upd ateRecord requires t he type pa rameter.") ; | |||||
| 251 | ///<para m name="su ccessCallb ack" type= "Function" > | |||||
| 252 | /// The function t hat will b e passed t hrough and be called by a succ essful res ponse. | |||||
| 253 | /// Noth ing will b e returned to this f unction. | |||||
| 254 | /// </pa ram> | |||||
| 255 | this._ca llbackPara meterCheck (successCa llback, "S DK.JQuery. updateReco rd require s the succ essCallbac k is a fun ction."); | |||||
| 256 | ///<para m name="er rorCallbac k" type="F unction"> | |||||
| 257 | /// The function t hat will b e passed t hrough and be called by a fail ed respons e. | |||||
| 258 | /// This function must accep t an Error object as a paramet er. | |||||
| 259 | /// </pa ram> | |||||
| 260 | this._ca llbackPara meterCheck (errorCall back, "SDK .JQuery.up dateRecord requires the errorC allback is a functio n."); | |||||
| 261 | ||||||
| 262 | var json Entity = w indow.JSON .stringify (object); | |||||
| 263 | ||||||
| 264 | $.ajax({ | |||||
| 265 | type: " POST", | |||||
| 266 | content Type: "app lication/j son; chars et=utf-8", | |||||
| 267 | datatyp e: "json", | |||||
| 268 | data: j sonEntity, | |||||
| 269 | url: th is._ODataP ath() + ty pe + "Set" + "(guid' " + id + " ')", | |||||
| 270 | beforeS end: funct ion (xhr) { | |||||
| 271 | //Spec ifying thi s header e nsures tha t the resu lts will b e returned as JSON. | |||||
| 272 | xhr.se tRequestHe ader("Acce pt", "appl ication/js on"); | |||||
| 273 | //Spec ify the HT TP method MERGE to u pdate just the chang es you are submittin g. | |||||
| 274 | xhr.se tRequestHe ader("X-HT TP-Method" , "MERGE") ; | |||||
| 275 | }, | |||||
| 276 | success : function (data, te xtStatus, xhr) { | |||||
| 277 | //Nothi ng is retu rned to th e success function | |||||
| 278 | succes sCallback( ); | |||||
| 279 | }, | |||||
| 280 | error: function ( xhr, textS tatus, err orThrown) { | |||||
| 281 | errorC allback(SD K.JQuery._ errorHandl er(xhr)); | |||||
| 282 | } | |||||
| 283 | }); | |||||
| 284 | }, | |||||
| 285 | deleteRec ord: funct ion (id, t ype, succe ssCallback , errorCal lback) { | |||||
| 286 | ///<summ ary> | |||||
| 287 | /// Send s an async hronous re quest to d elete a re cord. | |||||
| 288 | ///</sum mary> | |||||
| 289 | ///<para m name="id " type="St ring"> | |||||
| 290 | /// A St ring repre senting th e GUID val ue for the record to delete. | |||||
| 291 | ///</par am> | |||||
| 292 | this._st ringParame terCheck(i d, "SDK.JQ uery.delet eRecord re quires the id parame ter."); | |||||
| 293 | ///<para m name="ty pe" type=" String"> | |||||
| 294 | /// The Schema Nam e of the E ntity type record to delete. | |||||
| 295 | /// For an Account record, u se "Accoun t" | |||||
| 296 | ///</par am> | |||||
| 297 | this._st ringParame terCheck(t ype, "SDK. JQuery.del eteRecord requires t he type pa rameter.") ; | |||||
| 298 | ///<para m name="su ccessCallb ack" type= "Function" > | |||||
| 299 | /// The function t hat will b e passed t hrough and be called by a succ essful res ponse. | |||||
| 300 | /// Noth ing will b e returned to this f unction. | |||||
| 301 | /// </pa ram> | |||||
| 302 | this._ca llbackPara meterCheck (successCa llback, "S DK.JQuery. deleteReco rd require s the succ essCallbac k is a fun ction."); | |||||
| 303 | ///<para m name="er rorCallbac k" type="F unction"> | |||||
| 304 | /// The function t hat will b e passed t hrough and be called by a fail ed respons e. | |||||
| 305 | /// This function must accep t an Error object as a paramet er. | |||||
| 306 | /// </pa ram> | |||||
| 307 | this._ca llbackPara meterCheck (errorCall back, "SDK .JQuery.de leteRecord requires the errorC allback is a functio n."); | |||||
| 308 | ||||||
| 309 | $.ajax({ | |||||
| 310 | type: " POST", | |||||
| 311 | content Type: "app lication/j son; chars et=utf-8", | |||||
| 312 | datatyp e: "json", | |||||
| 313 | url: th is._ODataP ath() + ty pe + "Set( guid'" + i d + "')", | |||||
| 314 | beforeS end: funct ion (XMLHt tpRequest) { | |||||
| 315 | //Spec ifying thi s header e nsures tha t the resu lts will b e returned as JSON. | |||||
| 316 | XMLHtt pRequest.s etRequestH eader("Acc ept", "app lication/j son"); | |||||
| 317 | //Spec ify the HT TP method DELETE to perform a delete ope ration. | |||||
| 318 | XMLHtt pRequest.s etRequestH eader("X-H TTP-Method ", "DELETE "); | |||||
| 319 | }, | |||||
| 320 | success : function (data, te xtStatus, xhr) { | |||||
| 321 | // Noth ing is ret urned to t he success function. | |||||
| 322 | succes sCallback( ); | |||||
| 323 | }, | |||||
| 324 | error: function ( xhr, textS tatus, err orThrown) { | |||||
| 325 | errorC allback(SD K.JQuery._ errorHandl er(xhr)); | |||||
| 326 | } | |||||
| 327 | }); | |||||
| 328 | }, | |||||
| 329 | retrieveM ultipleRec ords: func tion (type , options, successCa llback, er rorCallbac k, OnCompl ete) { | |||||
| 330 | ///<summ ary> | |||||
| 331 | /// Send s an async hronous re quest to r etrieve re cords. | |||||
| 332 | ///</sum mary> | |||||
| 333 | ///<para m name="ty pe" type=" String"> | |||||
| 334 | /// The Schema Nam e of the E ntity type records t o retrieve | |||||
| 335 | /// For an Account record, u se "Accoun t" | |||||
| 336 | ///</par am> | |||||
| 337 | this._st ringParame terCheck(t ype, "SDK. JQuery.ret rieveMulti pleRecords requires the type p arameter i s a string ."); | |||||
| 338 | ///<para m name="op tions" typ e="String" > | |||||
| 339 | /// A St ring repre senting th e OData Sy stem Query Options t o control the data r eturned | |||||
| 340 | /// Do n ot include the $top option, us e the top parameters to set th e maximum number of records to return. | |||||
| 341 | ///</par am> | |||||
| 342 | if (opti ons != nul l) | |||||
| 343 | this._s tringParam eterCheck( options, " SDK.JQuery .retrieveM ultipleRec ords requi res the op tions para meter is a string.") ; | |||||
| 344 | ///<para m name="su ccessCallb ack" type= "Function" > | |||||
| 345 | /// The function t hat will b e passed t hrough and be called for each page of re cords retu rned. | |||||
| 346 | /// This function should loo p through the result s and push the recor ds into an array. | |||||
| 347 | /// </pa ram> | |||||
| 348 | this._ca llbackPara meterCheck (successCa llback, "S DK.JQuery. retrieveMu ltipleReco rds requir es the suc cessCallba ck paramet er is a fu nction."); | |||||
| 349 | ///<para m name="er rorCallbac k" type="F unction"> | |||||
| 350 | /// The function t hat will b e passed t hrough and be called by a fail ed respons e. | |||||
| 351 | /// This function must accep t an Error object as a paramet er. | |||||
| 352 | /// </pa ram> | |||||
| 353 | this._ca llbackPara meterCheck (errorCall back, "SDK .JQuery.re trieveMult ipleRecord s requires the error Callback p arameter i s a functi on."); | |||||
| 354 | ///<para m name="On Complete" type="Func tion"> | |||||
| 355 | /// The function t hat will b e called w hen all th e requeste d records have been returned. | |||||
| 356 | /// No p arameters are passed to this f unction. | |||||
| 357 | /// </pa ram> | |||||
| 358 | this._ca llbackPara meterCheck (OnComplet e, "SDK.JQ uery.retri eveMultipl eRecords r equires th e OnComple te paramet er is a fu nction."); | |||||
| 359 | ||||||
| 360 | var opti onsString; | |||||
| 361 | if (opti ons != nul l) { | |||||
| 362 | if (opt ions.charA t(0) != "? ") { | |||||
| 363 | option sString = "?" + opti ons; | |||||
| 364 | } | |||||
| 365 | else | |||||
| 366 | { optio nsString = options; } | |||||
| 367 | } | |||||
| 368 | ||||||
| 369 | $.ajax({ | |||||
| 370 | type: " GET", | |||||
| 371 | content Type: "app lication/j son; chars et=utf-8", | |||||
| 372 | datatyp e: "json", | |||||
| 373 | url: th is._ODataP ath() + ty pe + "Set" + options String, | |||||
| 374 | beforeS end: funct ion (XMLHt tpRequest) { | |||||
| 375 | //Spec ifying thi s header e nsures tha t the resu lts will b e returned as JSON. | |||||
| 376 | XMLHtt pRequest.s etRequestH eader("Acc ept", "app lication/j son"); | |||||
| 377 | }, | |||||
| 378 | success : function (data, te xtStatus, xhr) { | |||||
| 379 | if (da ta && data .d && data .d.results ) { | |||||
| 380 | succe ssCallback (JSON.pars e(xhr.resp onseText, SDK.JQuery ._dateRevi ver).d.res ults); | |||||
| 381 | if (d ata.d.__ne xt != null ) { | |||||
| 382 | var queryOptio ns = data. d.__next.s ubstring(( SDK.JQuery ._ODataPat h() + type + "Set"). length); | |||||
| 383 | SDK. JQuery.ret rieveMulti pleRecords (type, que ryOptions, successCa llback, er rorCallbac k, OnCompl ete); | |||||
| 384 | } | |||||
| 385 | else | |||||
| 386 | { OnC omplete(); } | |||||
| 387 | } | |||||
| 388 | }, | |||||
| 389 | error: function ( xhr, textS tatus, err orThrown) { | |||||
| 390 | errorC allback(SD K.JQuery._ errorHandl er(xhr)); | |||||
| 391 | } | |||||
| 392 | }); | |||||
| 393 | }, | |||||
| 394 | __namespa ce: true | |||||
| 395 | }; |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.