resources/Editors/Editor.Roo.GridPanel.bjs
[app.Builder.js] / resources / Editors / Editor.Roo.grid.Grid.js
index 27c9dc2..6ca394d 100644 (file)
@@ -222,11 +222,33 @@ Editor.Roo.grid.Grid = new Roo.XComponent({
        this.table = "XXX";
        this.firstTxtCol = "XXX";
       
-      
+       
        var jreader = {};
        var     colmodel = [];
+       this.grid.dataSource.each(function(rec) {
+           if (!rec.data.active) {
+               return;
+           }
+           
+           
+           
+           colmodel.push({
+               "xtype": "ColumnModel",
+               "header": rec.data.title,
+               "width":  rec.data.width * 1,
+               "dataIndex": rec.data.dataIndex,
+               "|renderer": !rec.data.type.match(/date/i) ? 
+                       "function(v) { return String.format('{0}', v); }" :
+                       "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }" , // special for date
+               "|xns": "Roo.grid",
+               "*prop": "colModel[]"
+           });
+       });
+       
+       
+       
    
-       JSON.stringify({
+       alert("IPC:OUT:" + JSON.stringify({
            '|xns' : 'Roo',
            xtype : "GridPanel",
            "title": this.table,
@@ -279,7 +301,14 @@ Editor.Roo.grid.Grid = new Roo.XComponent({
                                    "|url": "baseURL + '/Roo/" + this.table + ".php'",
                                    "|xns": "Roo.data"
                                },
-                               jreader
+                               {
+                                   '*prop' : 'reader',
+                                   'xtype' : 'JsonReader',
+                                   '|xns' : 'Roo.data',
+                                   'id' : 'id',
+                                   'root' : 'data',
+                                   'totalProperty' : 'total'
+                               }
                            ]
                        },
                        {
@@ -334,7 +363,7 @@ Editor.Roo.grid.Grid = new Roo.XComponent({
            ]
            
            
-       }, null, 4)
+       }, null, 4));
    
    },
    xns : Roo,