roojs-ui.js
[roojs1] / roojs-bootstrap-debug.js
index 1afc748..0ab5de6 100644 (file)
@@ -11825,6 +11825,16 @@ Roo.extend(Roo.data.Store, Roo.util.Observable, {
         var r = this.reader.readRecords(o);
         this.loadRecords(r, {add: append}, true);
     },
+    
+     /**
+     * using 'cn' the nested child reader read the child array into it's child stores.
+     * @param {Object} rec The record with a 'children array
+     */
+    loadDataFromChildren : function(rec)
+    {
+        this.loadData(this.reader.toLoadData(rec));
+    },
+    
 
     /**
      * Gets the number of cached records.
@@ -13020,6 +13030,14 @@ Roo.extend(Roo.data.JsonReader, Roo.data.DataReader, {
             records : records,
             totalRecords : totalRecords
         };
+    },
+    // used when loading children.. @see loadDataFromChildren
+    toLoadData: function(rec)
+    {
+       // expect rec just to be an array.. eg [a,b,c, [...] << cn ]
+       var data = typeof(rec.data.cn) == 'undefined' ? [] : rec.data.cn;
+       return { data : data, total : data.length };
+       
     }
 });/*
  * Based on:
@@ -13108,14 +13126,11 @@ Roo.extend(Roo.data.ArrayReader, Roo.data.JsonReader, {
            totalRecords : records.length
        };
     },
-    /**
-     * using 'cn' the nested child reader read the child array into it's child stores.
-     *
-     */
-    loadDataFromChildren: function(rec)
+    // used when loading children.. @see loadDataFromChildren
+    toLoadData: function(rec)
     {
        // expect rec just to be an array.. eg [a,b,c, [...] << cn ]
-       return this.loadData(rec.data.cn);
+       return typeof(rec.data.cn) == 'undefined' ? [] : rec.data.cn;
        
     }