| 1 |
define(["dojo/_base/lang", "dojo/_base/declare", "dojo/_base/xhr", "dojo/_base/kernel","dojo/data/util/filter", "dojo/data/util/simpleFetch"], |
| 2 |
function(lang, declare, xhr, kernel, filterUtil, simpleFetch) { |
| 3 |
|
| 4 |
var CsvStore = declare("dojox.data.CsvStore", null, { |
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
constructor: function( keywordParameters){ |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
this._attributes = []; |
| 34 |
this._attributeIndexes = {}; |
| 35 |
this._dataArray = []; |
| 36 |
this._arrayOfAllItems = []; |
| 37 |
this._loadFinished = false; |
| 38 |
if(keywordParameters.url){ |
| 39 |
this.url = keywordParameters.url; |
| 40 |
} |
| 41 |
this._csvData = keywordParameters.data; |
| 42 |
if(keywordParameters.label){ |
| 43 |
this.label = keywordParameters.label; |
| 44 |
}else if(this.label === ""){ |
| 45 |
this.label = undefined; |
| 46 |
} |
| 47 |
this._storeProp = "_csvStore"; |
| 48 |
this._idProp = "_csvId"; |
| 49 |
this._features = { |
| 50 |
'dojo.data.api.Read': true, |
| 51 |
'dojo.data.api.Identity': true |
| 52 |
}; |
| 53 |
this._loadInProgress = false; |
| 54 |
this._queuedFetches = []; |
| 55 |
this.identifier = keywordParameters.identifier; |
| 56 |
if(this.identifier === ""){ |
| 57 |
delete this.identifier; |
| 58 |
}else{ |
| 59 |
this._idMap = {}; |
| 60 |
} |
| 61 |
if("separator" in keywordParameters){ |
| 62 |
this.separator = keywordParameters.separator; |
| 63 |
} |
| 64 |
if("urlPreventCache" in keywordParameters){ |
| 65 |
this.urlPreventCache = keywordParameters.urlPreventCache?true:false; |
| 66 |
} |
| 67 |
}, |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
url: "", |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
label: "", |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
identifier: "", |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
separator: ",", |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
urlPreventCache: false, |
| 92 |
|
| 93 |
_assertIsItem: function( item){ |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
if(!this.isItem(item)){ |
| 99 |
throw new Error(this.declaredClass + ": a function was passed an item argument that was not an item"); |
| 100 |
} |
| 101 |
}, |
| 102 |
|
| 103 |
_getIndex: function(item){ |
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
var idx = this.getIdentity(item); |
| 109 |
if(this.identifier){ |
| 110 |
idx = this._idMap[idx]; |
| 111 |
} |
| 112 |
return idx; |
| 113 |
}, |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
getValue: function( item, |
| 119 |
attribute, |
| 120 |
defaultValue){ |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
this._assertIsItem(item); |
| 126 |
var itemValue = defaultValue; |
| 127 |
if(typeof attribute === "string"){ |
| 128 |
var ai = this._attributeIndexes[attribute]; |
| 129 |
if(ai != null){ |
| 130 |
var itemData = this._dataArray[this._getIndex(item)]; |
| 131 |
itemValue = itemData[ai] || defaultValue; |
| 132 |
} |
| 133 |
}else{ |
| 134 |
throw new Error(this.declaredClass + ": a function was passed an attribute argument that was not a string"); |
| 135 |
} |
| 136 |
return itemValue; |
| 137 |
}, |
| 138 |
|
| 139 |
getValues: function( item, |
| 140 |
attribute){ |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
var value = this.getValue(item, attribute); |
| 146 |
return (value ? [value] : []); |
| 147 |
}, |
| 148 |
|
| 149 |
getAttributes: function( item){ |
| 150 |
|
| 151 |
|
| 152 |
this._assertIsItem(item); |
| 153 |
var attributes = []; |
| 154 |
var itemData = this._dataArray[this._getIndex(item)]; |
| 155 |
for(var i=0; i<itemData.length; i++){ |
| 156 |
|
| 157 |
if(itemData[i] !== ""){ |
| 158 |
attributes.push(this._attributes[i]); |
| 159 |
} |
| 160 |
} |
| 161 |
return attributes; |
| 162 |
}, |
| 163 |
|
| 164 |
hasAttribute: function( item, |
| 165 |
attribute){ |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
this._assertIsItem(item); |
| 172 |
if(typeof attribute === "string"){ |
| 173 |
var attributeIndex = this._attributeIndexes[attribute]; |
| 174 |
var itemData = this._dataArray[this._getIndex(item)]; |
| 175 |
return (typeof attributeIndex !== "undefined" && attributeIndex < itemData.length && itemData[attributeIndex] !== ""); |
| 176 |
}else{ |
| 177 |
throw new Error(this.declaredClass + ": a function was passed an attribute argument that was not a string"); |
| 178 |
} |
| 179 |
}, |
| 180 |
|
| 181 |
containsValue: function( item, |
| 182 |
attribute, |
| 183 |
value){ |
| 184 |
|
| 185 |
|
| 186 |
var regexp = undefined; |
| 187 |
if(typeof value === "string"){ |
| 188 |
regexp = filterUtil.patternToRegExp(value, false); |
| 189 |
} |
| 190 |
return this._containsValue(item, attribute, value, regexp); |
| 191 |
}, |
| 192 |
|
| 193 |
_containsValue: function( item, |
| 194 |
attribute, |
| 195 |
value, |
| 196 |
regexp){ |
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
var values = this.getValues(item, attribute); |
| 215 |
for(var i = 0; i < values.length; ++i){ |
| 216 |
var possibleValue = values[i]; |
| 217 |
if(typeof possibleValue === "string" && regexp){ |
| 218 |
return (possibleValue.match(regexp) !== null); |
| 219 |
}else{ |
| 220 |
|
| 221 |
if(value === possibleValue){ |
| 222 |
return true; |
| 223 |
} |
| 224 |
} |
| 225 |
} |
| 226 |
return false; |
| 227 |
}, |
| 228 |
|
| 229 |
isItem: function( something){ |
| 230 |
|
| 231 |
|
| 232 |
if(something && something[this._storeProp] === this){ |
| 233 |
var identity = something[this._idProp]; |
| 234 |
|
| 235 |
|
| 236 |
if(this.identifier){ |
| 237 |
var data = this._dataArray[this._idMap[identity]]; |
| 238 |
if(data){ |
| 239 |
return true; |
| 240 |
} |
| 241 |
}else{ |
| 242 |
if(identity >= 0 && identity < this._dataArray.length){ |
| 243 |
return true; |
| 244 |
} |
| 245 |
} |
| 246 |
} |
| 247 |
return false; |
| 248 |
}, |
| 249 |
|
| 250 |
isItemLoaded: function( something){ |
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
return this.isItem(something); |
| 255 |
}, |
| 256 |
|
| 257 |
loadItem: function( item){ |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
}, |
| 268 |
|
| 269 |
getFeatures: function(){ |
| 270 |
|
| 271 |
|
| 272 |
return this._features; |
| 273 |
}, |
| 274 |
|
| 275 |
getLabel: function( item){ |
| 276 |
|
| 277 |
|
| 278 |
if(this.label && this.isItem(item)){ |
| 279 |
return this.getValue(item,this.label); |
| 280 |
} |
| 281 |
return undefined; |
| 282 |
}, |
| 283 |
|
| 284 |
getLabelAttributes: function( item){ |
| 285 |
|
| 286 |
|
| 287 |
if(this.label){ |
| 288 |
return [this.label]; |
| 289 |
} |
| 290 |
return null; |
| 291 |
}, |
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
_fetchItems: function( keywordArgs, |
| 298 |
findCallback, |
| 299 |
errorCallback){ |
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
var self = this; |
| 305 |
var filter = function(requestArgs, arrayOfAllItems){ |
| 306 |
var items = null; |
| 307 |
if(requestArgs.query){ |
| 308 |
var key, value; |
| 309 |
items = []; |
| 310 |
var ignoreCase = requestArgs.queryOptions ? requestArgs.queryOptions.ignoreCase : false; |
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
var regexpList = {}; |
| 315 |
for(key in requestArgs.query){ |
| 316 |
value = requestArgs.query[key]; |
| 317 |
if(typeof value === "string"){ |
| 318 |
regexpList[key] = filterUtil.patternToRegExp(value, ignoreCase); |
| 319 |
} |
| 320 |
} |
| 321 |
|
| 322 |
for(var i = 0; i < arrayOfAllItems.length; ++i){ |
| 323 |
var match = true; |
| 324 |
var candidateItem = arrayOfAllItems[i]; |
| 325 |
for(key in requestArgs.query){ |
| 326 |
value = requestArgs.query[key]; |
| 327 |
if(!self._containsValue(candidateItem, key, value, regexpList[key])){ |
| 328 |
match = false; |
| 329 |
} |
| 330 |
} |
| 331 |
if(match){ |
| 332 |
items.push(candidateItem); |
| 333 |
} |
| 334 |
} |
| 335 |
}else{ |
| 336 |
|
| 337 |
|
| 338 |
items = arrayOfAllItems.slice(0,arrayOfAllItems.length); |
| 339 |
|
| 340 |
} |
| 341 |
findCallback(items, requestArgs); |
| 342 |
}; |
| 343 |
|
| 344 |
if(this._loadFinished){ |
| 345 |
filter(keywordArgs, this._arrayOfAllItems); |
| 346 |
}else{ |
| 347 |
if(this.url !== ""){ |
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
if(this._loadInProgress){ |
| 352 |
this._queuedFetches.push({args: keywordArgs, filter: filter}); |
| 353 |
}else{ |
| 354 |
this._loadInProgress = true; |
| 355 |
var getArgs = { |
| 356 |
url: self.url, |
| 357 |
handleAs: "text", |
| 358 |
preventCache: self.urlPreventCache |
| 359 |
}; |
| 360 |
var getHandler = xhr.get(getArgs); |
| 361 |
getHandler.addCallback(function(data){ |
| 362 |
try{ |
| 363 |
self._processData(data); |
| 364 |
filter(keywordArgs, self._arrayOfAllItems); |
| 365 |
self._handleQueuedFetches(); |
| 366 |
}catch(e){ |
| 367 |
errorCallback(e, keywordArgs); |
| 368 |
} |
| 369 |
}); |
| 370 |
getHandler.addErrback(function(error){ |
| 371 |
self._loadInProgress = false; |
| 372 |
if(errorCallback){ |
| 373 |
errorCallback(error, keywordArgs); |
| 374 |
}else{ |
| 375 |
throw error; |
| 376 |
} |
| 377 |
}); |
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
var oldAbort = null; |
| 383 |
if(keywordArgs.abort){ |
| 384 |
oldAbort = keywordArgs.abort; |
| 385 |
} |
| 386 |
keywordArgs.abort = function(){ |
| 387 |
var df = getHandler; |
| 388 |
if(df && df.fired === -1){ |
| 389 |
df.cancel(); |
| 390 |
df = null; |
| 391 |
} |
| 392 |
if(oldAbort){ |
| 393 |
oldAbort.call(keywordArgs); |
| 394 |
} |
| 395 |
}; |
| 396 |
} |
| 397 |
}else if(this._csvData){ |
| 398 |
try{ |
| 399 |
this._processData(this._csvData); |
| 400 |
this._csvData = null; |
| 401 |
filter(keywordArgs, this._arrayOfAllItems); |
| 402 |
}catch(e){ |
| 403 |
errorCallback(e, keywordArgs); |
| 404 |
} |
| 405 |
}else{ |
| 406 |
var error = new Error(this.declaredClass + ": No CSV source data was provided as either URL or String data input."); |
| 407 |
if(errorCallback){ |
| 408 |
errorCallback(error, keywordArgs); |
| 409 |
}else{ |
| 410 |
throw error; |
| 411 |
} |
| 412 |
} |
| 413 |
} |
| 414 |
}, |
| 415 |
|
| 416 |
close: function( request){ |
| 417 |
|
| 418 |
|
| 419 |
}, |
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
_getArrayOfArraysFromCsvFileContents: function( csvFileContents){ |
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
if(lang.isString(csvFileContents)){ |
| 448 |
var leadingWhiteSpaceCharacters = new RegExp("^\\s+",'g'); |
| 449 |
var trailingWhiteSpaceCharacters = new RegExp("\\s+$",'g'); |
| 450 |
var doubleQuotes = new RegExp('""','g'); |
| 451 |
var arrayOfOutputRecords = []; |
| 452 |
var i; |
| 453 |
|
| 454 |
var arrayOfInputLines = this._splitLines(csvFileContents); |
| 455 |
for(i = 0; i < arrayOfInputLines.length; ++i){ |
| 456 |
var singleLine = arrayOfInputLines[i]; |
| 457 |
if(singleLine.length > 0){ |
| 458 |
var listOfFields = singleLine.split(this.separator); |
| 459 |
var j = 0; |
| 460 |
while(j < listOfFields.length){ |
| 461 |
var space_field_space = listOfFields[j]; |
| 462 |
var field_space = space_field_space.replace(leadingWhiteSpaceCharacters, ''); |
| 463 |
var field = field_space.replace(trailingWhiteSpaceCharacters, ''); |
| 464 |
var firstChar = field.charAt(0); |
| 465 |
var lastChar = field.charAt(field.length - 1); |
| 466 |
var secondToLastChar = field.charAt(field.length - 2); |
| 467 |
var thirdToLastChar = field.charAt(field.length - 3); |
| 468 |
if(field.length === 2 && field == "\"\""){ |
| 469 |
listOfFields[j] = ""; |
| 470 |
}else if((firstChar == '"') && |
| 471 |
((lastChar != '"') || |
| 472 |
((lastChar == '"') && (secondToLastChar == '"') && (thirdToLastChar != '"')))){ |
| 473 |
if(j+1 === listOfFields.length){ |
| 474 |
|
| 475 |
return; |
| 476 |
} |
| 477 |
var nextField = listOfFields[j+1]; |
| 478 |
listOfFields[j] = field_space + this.separator + nextField; |
| 479 |
listOfFields.splice(j+1, 1); |
| 480 |
}else{ |
| 481 |
if((firstChar == '"') && (lastChar == '"')){ |
| 482 |
field = field.slice(1, (field.length - 1)); |
| 483 |
field = field.replace(doubleQuotes, '"'); |
| 484 |
} |
| 485 |
listOfFields[j] = field; |
| 486 |
j += 1; |
| 487 |
} |
| 488 |
} |
| 489 |
arrayOfOutputRecords.push(listOfFields); |
| 490 |
} |
| 491 |
} |
| 492 |
|
| 493 |
|
| 494 |
this._attributes = arrayOfOutputRecords.shift(); |
| 495 |
for(i = 0; i<this._attributes.length; i++){ |
| 496 |
|
| 497 |
this._attributeIndexes[this._attributes[i]] = i; |
| 498 |
} |
| 499 |
this._dataArray = arrayOfOutputRecords; |
| 500 |
} |
| 501 |
}, |
| 502 |
|
| 503 |
_splitLines: function(csvContent){ |
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
var split = []; |
| 511 |
var i; |
| 512 |
var line = ""; |
| 513 |
var inQuotes = false; |
| 514 |
for(i = 0; i < csvContent.length; i++){ |
| 515 |
var c = csvContent.charAt(i); |
| 516 |
switch(c){ |
| 517 |
case '\"': |
| 518 |
inQuotes = !inQuotes; |
| 519 |
line += c; |
| 520 |
break; |
| 521 |
case '\r': |
| 522 |
if(inQuotes){ |
| 523 |
line += c; |
| 524 |
}else{ |
| 525 |
split.push(line); |
| 526 |
line = ""; |
| 527 |
if(i < (csvContent.length - 1) && csvContent.charAt(i + 1) == '\n'){ |
| 528 |
i++; |
| 529 |
} |
| 530 |
} |
| 531 |
break; |
| 532 |
case '\n': |
| 533 |
if(inQuotes){ |
| 534 |
line += c; |
| 535 |
}else{ |
| 536 |
split.push(line); |
| 537 |
line = ""; |
| 538 |
} |
| 539 |
break; |
| 540 |
default: |
| 541 |
line +=c; |
| 542 |
} |
| 543 |
} |
| 544 |
if(line !== ""){ |
| 545 |
split.push(line); |
| 546 |
} |
| 547 |
return split; |
| 548 |
}, |
| 549 |
|
| 550 |
_processData: function( data){ |
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
this._getArrayOfArraysFromCsvFileContents(data); |
| 558 |
this._arrayOfAllItems = []; |
| 559 |
|
| 560 |
|
| 561 |
if(this.identifier){ |
| 562 |
if(this._attributeIndexes[this.identifier] === undefined){ |
| 563 |
throw new Error(this.declaredClass + ": Identity specified is not a column header in the data set."); |
| 564 |
} |
| 565 |
} |
| 566 |
|
| 567 |
for(var i=0; i<this._dataArray.length; i++){ |
| 568 |
var id = i; |
| 569 |
|
| 570 |
|
| 571 |
if(this.identifier){ |
| 572 |
var iData = this._dataArray[i]; |
| 573 |
id = iData[this._attributeIndexes[this.identifier]]; |
| 574 |
this._idMap[id] = i; |
| 575 |
} |
| 576 |
this._arrayOfAllItems.push(this._createItemFromIdentity(id)); |
| 577 |
} |
| 578 |
this._loadFinished = true; |
| 579 |
this._loadInProgress = false; |
| 580 |
}, |
| 581 |
|
| 582 |
_createItemFromIdentity: function( identity){ |
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
var item = {}; |
| 590 |
item[this._storeProp] = this; |
| 591 |
item[this._idProp] = identity; |
| 592 |
return item; |
| 593 |
}, |
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
|
| 599 |
getIdentity: function( item){ |
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
|
| 604 |
if(this.isItem(item)){ |
| 605 |
return item[this._idProp]; |
| 606 |
} |
| 607 |
return null; |
| 608 |
}, |
| 609 |
|
| 610 |
fetchItemByIdentity: function( keywordArgs){ |
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
var item; |
| 616 |
var scope = keywordArgs.scope?keywordArgs.scope:kernel.global; |
| 617 |
|
| 618 |
if(!this._loadFinished){ |
| 619 |
var self = this; |
| 620 |
if(this.url !== ""){ |
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
if(this._loadInProgress){ |
| 625 |
this._queuedFetches.push({args: keywordArgs}); |
| 626 |
}else{ |
| 627 |
this._loadInProgress = true; |
| 628 |
var getArgs = { |
| 629 |
url: self.url, |
| 630 |
handleAs: "text" |
| 631 |
}; |
| 632 |
var getHandler = xhr.get(getArgs); |
| 633 |
getHandler.addCallback(function(data){ |
| 634 |
try{ |
| 635 |
self._processData(data); |
| 636 |
var item = self._createItemFromIdentity(keywordArgs.identity); |
| 637 |
if(!self.isItem(item)){ |
| 638 |
item = null; |
| 639 |
} |
| 640 |
if(keywordArgs.onItem){ |
| 641 |
keywordArgs.onItem.call(scope, item); |
| 642 |
} |
| 643 |
self._handleQueuedFetches(); |
| 644 |
}catch(error){ |
| 645 |
if(keywordArgs.onError){ |
| 646 |
keywordArgs.onError.call(scope, error); |
| 647 |
} |
| 648 |
} |
| 649 |
}); |
| 650 |
getHandler.addErrback(function(error){ |
| 651 |
this._loadInProgress = false; |
| 652 |
if(keywordArgs.onError){ |
| 653 |
keywordArgs.onError.call(scope, error); |
| 654 |
} |
| 655 |
}); |
| 656 |
} |
| 657 |
}else if(this._csvData){ |
| 658 |
try{ |
| 659 |
self._processData(self._csvData); |
| 660 |
self._csvData = null; |
| 661 |
item = self._createItemFromIdentity(keywordArgs.identity); |
| 662 |
if(!self.isItem(item)){ |
| 663 |
item = null; |
| 664 |
} |
| 665 |
if(keywordArgs.onItem){ |
| 666 |
keywordArgs.onItem.call(scope, item); |
| 667 |
} |
| 668 |
}catch(e){ |
| 669 |
if(keywordArgs.onError){ |
| 670 |
keywordArgs.onError.call(scope, e); |
| 671 |
} |
| 672 |
} |
| 673 |
} |
| 674 |
}else{ |
| 675 |
|
| 676 |
item = this._createItemFromIdentity(keywordArgs.identity); |
| 677 |
if(!this.isItem(item)){ |
| 678 |
item = null; |
| 679 |
} |
| 680 |
if(keywordArgs.onItem){ |
| 681 |
keywordArgs.onItem.call(scope, item); |
| 682 |
} |
| 683 |
} |
| 684 |
}, |
| 685 |
|
| 686 |
getIdentityAttributes: function( item){ |
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
if(this.identifier){ |
| 695 |
return [this.identifier]; |
| 696 |
}else{ |
| 697 |
return null; |
| 698 |
} |
| 699 |
}, |
| 700 |
|
| 701 |
_handleQueuedFetches: function(){ |
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
if(this._queuedFetches.length > 0){ |
| 709 |
for(var i = 0; i < this._queuedFetches.length; i++){ |
| 710 |
var fData = this._queuedFetches[i]; |
| 711 |
var delayedFilter = fData.filter; |
| 712 |
var delayedQuery = fData.args; |
| 713 |
if(delayedFilter){ |
| 714 |
delayedFilter(delayedQuery, this._arrayOfAllItems); |
| 715 |
}else{ |
| 716 |
this.fetchItemByIdentity(fData.args); |
| 717 |
} |
| 718 |
} |
| 719 |
this._queuedFetches = []; |
| 720 |
} |
| 721 |
} |
| 722 |
}); |
| 723 |
|
| 724 |
lang.extend(CsvStore, simpleFetch); |
| 725 |
|
| 726 |
return CsvStore; |
| 727 |
}); |