| 1 | define([], function(){ |
| 2 | |
| 3 | var repeatmodel = null; //repeat view data model |
| 4 | |
| 5 | // show an item detail |
| 6 | var setDetailsContext = function(index){ |
| 7 | // only set the cursor if it is different and valid |
| 8 | if(parseInt(index) != repeatmodel.cursorIndex && parseInt(index) < repeatmodel.model.length){ |
| 9 | repeatmodel.set("cursorIndex", parseInt(index)); |
| 10 | } |
| 11 | }; |
| 12 | |
| 13 | return { |
| 14 | // repeat view init |
| 15 | init: function(){ |
| 16 | repeatmodel = this.loadedModels.repeatmodels; |
| 17 | }, |
| 18 | |
| 19 | beforeActivate: function(){ |
| 20 | // summary: |
| 21 | // view life cycle beforeActivate() |
| 22 | // |
| 23 | // if this.params["cursor"] is set use it to set the selected Details Context |
| 24 | if(this.params["cursor"]){ |
| 25 | setDetailsContext(this.params["cursor"]); |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | }); |