roojs-ui.js
[roojs1] / roojs-debug.js
index ce0b6de..65e095a 100644 (file)
@@ -23582,8 +23582,7 @@ Roo.data.SimpleStore = function(config)
     Roo.data.SimpleStore.superclass.constructor.call(this, {
         isLocal : true,
         reader: typeof(config.reader) != 'undefined' ? config.reader : new Roo.data.ArrayReader({
-                id: config.id,
-                fields : config.fields
+                id: config.id
             },
             Roo.data.Record.create(config.fields)
         ),
@@ -23759,6 +23758,9 @@ Roo.data.DataReader = function(meta, recordType){
 };
 
 Roo.data.DataReader.prototype = {
+    
+    
+    readerType : 'Data',
      /**
      * Create an empty record
      * @param {Object} data (optional) - overlay some values
@@ -24318,6 +24320,8 @@ Roo.data.JsonReader = function(meta, recordType){
 };
 Roo.extend(Roo.data.JsonReader, Roo.data.DataReader, {
     
+    readerType : 'Json',
+    
     /**
      * @prop {Boolean} metaFromRemote  - if the meta data was loaded from the remote source.
      * Used by Store query builder to append _requestMeta to params.
@@ -24529,6 +24533,9 @@ Roo.data.XmlReader = function(meta, recordType){
     Roo.data.XmlReader.superclass.constructor.call(this, meta, recordType||meta.fields);
 };
 Roo.extend(Roo.data.XmlReader, Roo.data.DataReader, {
+    
+    readerType : 'Xml',
+    
     /**
      * This method is only used by a DataProxy which has retrieved data from a remote server.
         * @param {Object} response The XHR object which contains the parsed XML document.  The response is expected
@@ -24646,6 +24653,8 @@ Roo.data.ArrayReader = function(meta, recordType)
 };
 
 Roo.extend(Roo.data.ArrayReader, Roo.data.JsonReader, {
+    
+    readerType : 'Array',
     /**
      * Create a data block containing Roo.data.Records from an XML document.
      * @param {Object} o An Array of row objects which represents the dataset.
@@ -42716,6 +42725,11 @@ Roo.form.ComboNested = function(config){
 
 Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
    
+    /*
+     * @config {Number} max Number of columns to show
+     */
+    
+    maxColumns : 3,
    
     list : null, // the outermost div..
     innerLists : null, // the
@@ -42761,7 +42775,7 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
         this.innerLists = [];
         this.views = [];
         this.stores = [];
-        for (var i =0 ; i < 3; i++) {
+        for (var i =0 ; i < this.maxColumns; i++) {
             this.onRenderList( cls, i);
         }
         
@@ -42800,7 +42814,7 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
     {
         
         var lw = Math.floor(
-                ((this.listWidth * 3 || Math.max(this.wrap.getWidth(), this.minListWidth)) - this.list.getFrameWidth('lr')) / 3
+                ((this.listWidth * this.maxColumns || Math.max(this.wrap.getWidth(), this.minListWidth)) - this.list.getFrameWidth('lr')) / this.maxColumns
         );
         
         this.list.setWidth(lw); // default to '1'
@@ -42815,7 +42829,9 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
             this.tpl = new Roo.Template({
                 html :  '<div class="'+cls+'-item '+cls+'-item-{cn:this.isEmpty}">{' + this.displayField + '}</div>',
                 isEmpty: function (value, allValues) {
-                    return value && value.length ? 'has-children' : 'no-children'
+                    //Roo.log(value);
+                    var dl = typeof(value.data) != 'undefined' ? value.data.length : value.length; ///json is a nested response..
+                    return dl ? 'has-children' : 'no-children'
                 }
             });
         }
@@ -42823,7 +42839,8 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
         var store  = this.store;
         if (i > 0) {
             store  = new Roo.data.SimpleStore({
-                fields : this.store.reader.meta.fields,
+                //fields : this.store.reader.meta.fields,
+                reader : this.store.reader,
                 data : [ ]
             });
         }
@@ -42944,7 +42961,7 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
         var ix = view.getSelectedIndexes();
         
         
-        if (opts.list > 1) {
+        if (opts.list > this.maxColumns - 2) {
              
             this.setFromData(ix.length ? view.store.getAt(ix[0]).data : {});
             return;
@@ -42952,7 +42969,8 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
         
         if (!ix.length) {
             this.setFromData({});
-            this.stores[opts.list+1].loadData( [] );
+            var str = this.stores[opts.list+1];
+            str.removeAll();
             return;
         }
         
@@ -42960,14 +42978,15 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
         this.setFromData(rec.data);
         
         var lw = Math.floor(
-                ((this.listWidth * 3 || Math.max(this.wrap.getWidth(), this.minListWidth)) - this.list.getFrameWidth('lr')) / 3
+                ((this.listWidth * this.maxColumns || Math.max(this.wrap.getWidth(), this.minListWidth)) - this.list.getFrameWidth('lr')) / this.maxColumns
         );
         var data =  typeof(rec.data.cn) == 'undefined' ? [] : rec.data.cn;
+        var dl = typeof(data.data) != 'undefined' ? data.total : data.length; ///json is a nested response..
         this.stores[opts.list+1].loadData( data );
         this.views[opts.list+1].getEl().setHeight( this.innerLists[0].getHeight());
-        this.views[opts.list+1].getEl().setStyle({ display : data .length ? 'block' : 'none' });
+        this.views[opts.list+1].getEl().setStyle({ display : dl ? 'block' : 'none' });
         this.innerLists[opts.list+1].setHeight( this.innerLists[0].getHeight());
-        this.list.setWidth(lw * (opts.list + (data.length ? 2 : 1))); 
+        this.list.setWidth(lw * (opts.list + (dl ? 2 : 1))); 
     },
     onDoubleClick : function()
     {
@@ -42985,7 +43004,8 @@ Roo.extend(Roo.form.ComboNested, Roo.form.ComboBox, {
     findRecordInStore : function(store, prop, value)
     {
         var cstore = new Roo.data.SimpleStore({
-            fields : this.store.reader.meta.fields, // we need array reader.. for 
+            //fields : this.store.reader.meta.fields, // we need array reader.. for
+            reader : this.store.reader,
             data : [ ]
         });
         var _this = this;