123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- define("dojox/mvc/Repeat", [
- "dojo/_base/declare",
- "dojo/dom",
- "./_Container"
- ], function(declare, dom, _Container){
-
- return declare("dojox.mvc.Repeat", [_Container], {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- index : 0,
-
-
- postscript: function(params, srcNodeRef){
- this.srcNodeRef = dom.byId(srcNodeRef);
- if(this.srcNodeRef){
- if(this.templateString == ""){
- this.templateString = this.srcNodeRef.innerHTML;
- }
- this.srcNodeRef.innerHTML = "";
- }
- this.inherited(arguments);
- },
-
- _updateBinding: function(name, old, current){
-
-
-
-
- this.inherited(arguments);
- this._buildContained();
- },
- _buildContained: function(){
-
-
-
-
-
-
- this._destroyBody();
- this._updateAddRemoveWatch();
- var insert = "";
- for(this.index = 0; this.get("binding").get(this.index); this.index++){
- insert += this._exprRepl(this.templateString);
- }
- var repeatNode = this.srcNodeRef || this.domNode;
- repeatNode.innerHTML = insert;
-
-
- this.srcNodeRef = repeatNode;
- this._createBody();
- },
- _updateAddRemoveWatch: function(){
-
-
-
-
- if(this._addRemoveWatch){
- this._addRemoveWatch.unwatch();
- }
- var pThis = this;
- this._addRemoveWatch = this.get("binding").watch(function(name,old,current){
- if(/^[0-9]+$/.test(name.toString())){
- if(!old || !current){
- pThis._buildContained();
- }
- }
- });
- }
- });
- });
|