Roo/form/ComboBoxArray.js
[roojs1] / Roo / View.js
index c4bd9c3..2939ddf 100644 (file)
@@ -219,10 +219,7 @@ Roo.extend(Roo.View, Roo.util.Observable, {
         //      roo-name="data" node?
         //      <span class='roo-tpl-{name}'></span> ?????
         
-        var el = this.el;
-        if (this.dataName) {
-            
-        }
+        
         
         this.clearSelections();
         this.el.update("");
@@ -235,18 +232,26 @@ Roo.extend(Roo.View, Roo.util.Observable, {
             this.el.update(this.emptyText);
             return;
         }
-        
+        var el = this.el;
+        if (this.dataName) {
+            this.el.update(t.apply(this.store.meta)); //????
+            el = this.el.child('.roo-tpl-' + this.dataName);
+        }
         
         for(var i = 0, len = records.length; i < len; i++){
             var data = this.prepareData(records[i].data, i, records[i]);
             this.fireEvent("preparedata", this, data, i, records[i]);
-            html[html.length] = Roo.util.Format.trim( t.apply(data) );
+            html[html.length] = Roo.util.Format.trim(
+                this.dataName ?
+                    t.applySubtemplate(this.dataName, data, this.store.meta) :
+                    t.apply(data)
+            );
         }
         
         
         
-        this.el.update(html.join(""));
-        this.nodes = this.el.dom.childNodes;
+        el.update(html.join(""));
+        this.nodes = el.dom.childNodes;
         this.updateIndexes(0);
     },
 
@@ -272,7 +277,11 @@ Roo.extend(Roo.View, Roo.util.Observable, {
         this.updateIndexes(index, index);
     },
 
-    onAdd : function(ds, records, index){
+    
+    
+// --------- FIXME     
+    onAdd : function(ds, records, index)
+    {
         this.clearSelections();
         if(this.nodes.length == 0){
             this.refresh();
@@ -284,6 +293,7 @@ Roo.extend(Roo.View, Roo.util.Observable, {
             if(n){
                 this.tpl.insertBefore(n, d);
             }else{
+                
                 this.tpl.append(this.el, d);
             }
         }
@@ -292,7 +302,10 @@ Roo.extend(Roo.View, Roo.util.Observable, {
 
     onRemove : function(ds, record, index){
         this.clearSelections();
-        this.el.dom.removeChild(this.nodes[index]);
+        var el = this.dataName  ?
+            this.el.child('.roo-tpl-' + this.dataName) :
+            this.el; 
+        el.dom.removeChild(this.nodes[index]);
         this.updateIndexes(index);
     },
 
@@ -345,7 +358,10 @@ Roo.extend(Roo.View, Roo.util.Observable, {
      * @return {HTMLElement} The template node
      */
     findItemFromChild : function(node){
-        var el = this.el.dom;
+        var el = this.dataName  ?
+            this.el.child('.roo-tpl-' + this.dataName,true) :
+            this.el.dom; 
+        
         if(!node || node.parentNode == el){
                    return node;
            }