|
328 | 328 | } |
329 | 329 | } |
330 | 330 | this._splices = []; |
331 | | - // Update final _keyToInstIdx and inst indices |
| 331 | + // Update final _keyToInstIdx and instance indices |
332 | 332 | var keyToIdx = this._keyToInstIdx = {}; |
333 | 333 | var keys = this._keys; |
334 | 334 | for (var i=0; i<keys.length; i++) { |
335 | 335 | var key = keys[i]; |
336 | | - var inst = this._instances[i]; |
337 | 336 | keyToIdx[key] = i; |
| 337 | + var inst = this._instances[i]; |
338 | 338 | inst.__setProperty(this.indexAs, i, true); |
339 | 339 | } |
340 | 340 | this.fire('dom-change'); |
|
343 | 343 | // Render method 1: full refesh |
344 | 344 | // ---- |
345 | 345 | // Full list of keys is pulled from the collection, then sorted, filtered, |
346 | | - // and interated to create (or reuse) existing instances |
| 346 | + // and iterated to create (or reuse) existing instances |
347 | 347 | _applyFullRefresh: function() { |
348 | 348 | var c = this.collection; |
349 | | - // Start with unordered keys for view sort, |
350 | | - // or get them in array order for array sort |
| 349 | + // Start with unordered keys for user sort, |
| 350 | + // or get them in array order for array order |
351 | 351 | if (this._sortFn) { |
352 | 352 | this._keys = c ? c.getKeys() : []; |
353 | 353 | } else { |
|
377 | 377 | var key = keys[i]; |
378 | 378 | var inst = this._instances[i]; |
379 | 379 | if (!inst) { |
380 | | - this._instances.push(this._insertRow(i, null, key)); |
| 380 | + this._instances.push(this._insertRow(i, key)); |
381 | 381 | } else { |
382 | 382 | inst.__setProperty('__key__', key, true); |
383 | 383 | inst.__setProperty(this.as, c.getItem(key), true); |
|
430 | 430 | // Remove & pool removed instances |
431 | 431 | if (removedIdxs.length) { |
432 | 432 | // Sort removed instances idx's then remove backwards, |
433 | | - // so we don't invalidate inst index |
| 433 | + // so we don't invalidate instance index |
434 | 434 | removedIdxs.sort(); |
435 | 435 | for (var i=removedIdxs.length-1; i>=0 ; i--) { |
436 | 436 | var idx = removedIdxs[i]; |
|
487 | 487 | } |
488 | 488 | // Insert key & inst at insertion point |
489 | 489 | this._keys.splice(idx, 0, key); |
490 | | - this._instances.splice(idx, 0, this._insertRow(idx, pool, key)); |
| 490 | + this._instances.splice(idx, 0, this._insertRow(idx, key, pool)); |
491 | 491 | return idx; |
492 | 492 | }, |
493 | 493 |
|
|
527 | 527 | // Replace placeholders with actual instances (from pool or newly created) |
528 | 528 | this._instances.forEach(function(inst, idx) { |
529 | 529 | if (inst.isPlaceholder) { |
530 | | - this._instances[idx] = this._insertRow(idx, pool, inst.key); |
| 530 | + this._instances[idx] = this._insertRow(idx, inst.key, pool); |
531 | 531 | } |
532 | 532 | }, this); |
533 | 533 | }, |
|
544 | 544 | return inst; |
545 | 545 | }, |
546 | 546 |
|
547 | | - _insertRow: function(idx, pool, key) { |
| 547 | + _insertRow: function(idx, key, pool) { |
548 | 548 | var inst; |
549 | 549 | if (inst = pool && pool.pop()) { |
550 | 550 | inst.__setProperty(this.as, this.collection.getItem(key), true); |
|
0 commit comments