resources/Editors/Editor.Roo.grid.Grid.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 17 Apr 2015 01:41:21 +0000 (09:41 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 17 Apr 2015 01:41:21 +0000 (09:41 +0800)
resources/Editors/Editor.Roo.grid.Grid.js

resources/Editors/Editor.Roo.grid.Grid.bjs [new file with mode: 0644]
resources/Editors/Editor.Roo.grid.Grid.js [new file with mode: 0644]

diff --git a/resources/Editors/Editor.Roo.grid.Grid.bjs b/resources/Editors/Editor.Roo.grid.Grid.bjs
new file mode 100644 (file)
index 0000000..c624bb4
--- /dev/null
@@ -0,0 +1,146 @@
+{
+ "name" : "Editor.Roo.grid.Grid",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/alan/gitlive/app.Builder.js/resources/Editors/Editor.Roo.grid.Grid.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "strings" : {
+  "4ce58cbe362a5d7b156992a496d55bf3" : "Database Column",
+  "b78a3223503896721cca1303f776159b" : "Title",
+  "2f616612593df62aeed112de4f03110e" : "Edit a Grid",
+  "0ccc2bf3fb98387c23b6ca5500244d6e" : "Use ",
+  "c671c787b49f50a3ace9fdc5bd597825" : "core_enum",
+  "32954654ac8fe66a1d09be19001de2d4" : "Width",
+  "a1fa27779242b4902f7ae3bdd5c6d508" : "Type",
+  "6e7376dca68a2386a8737944196ab491" : "Create / Edit Grid"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+   },
+   "| function loadData" : "function(data) { \n\n     alert(\"IPC:TEST:\" + JSON.stringify(data,null,4));\n    var ar = [];\n    for (var k in data) { \n        var r = data[k];\n        ar.push([ false, r.Field, r.Type,  r.Field, 100] );\n    }\n    \n    alert(\"IPC:TEST:\" + JSON.stringify(ar));\n    this.grid.dataSource.loadData(ar);\n}",
+   "background" : false,
+   "fitToframe" : true,
+   "region" : "center",
+   "title" : "core_enum",
+   "xtype" : "GridPanel",
+   "$ xns" : "Roo",
+   "fitContainer" : true,
+   "String title" : "Create / Edit Grid",
+   "tableName" : "core_enum",
+   "items" : [
+    {
+     "listeners" : {
+      "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
+      "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
+      "cellclick" : "function (_self, rowIndex, columnIndex, e)\n{\n\n        var di = this.colModel.getDataIndex(columnIndex);\n        if (di != 'active') {\n            return;\n        }\n         \n        var rec = _this.grid.ds.getAt(rowIndex);\n        \n        rec.set('active', rec.data.active * 1 ? 0 : 1);\n        rec.commit();\n         \n        \n}"
+     },
+     "Number clicksToEdit" : 1,
+     "autoExpandColumn" : "title",
+     "xtype" : "EditorGrid",
+     "loadMask" : true,
+     "$ xns" : "Roo.grid",
+     "* prop" : "grid",
+     "items" : [
+      {
+       "$ Array fields" : "[ 'active', 'dataIndex', 'type','title', 'width' ]",
+       "$ Array data" : "[\n  [ 1, 'test', 'test', 110 ]\n  \n\n]",
+       "Number id" : "'dataIndex'",
+       "xtype" : "SimpleStore",
+       "$ xns" : "Roo.data",
+       "* prop" : "ds"
+      },
+      {
+       "xtype" : "Toolbar",
+       "$ xns" : "Roo",
+       "* prop" : "toolbar",
+       "items" : [
+        {
+         "string text" : "Edit a Grid",
+         "xtype" : "TextItem",
+         "$ xns" : "Roo.Toolbar"
+        }
+       ]
+      },
+      {
+       "xtype" : "ColumnModel",
+       "width" : 75,
+       "header" : "Use ",
+       "$ renderer" : "function(v) {  \n    var state = v *1 > 0 ?  '-checked' : '';\n\n    return '<img class=\"x-grid-check-icon' + state + '\" src=\"' + Roo.BLANK_IMAGE_URL + '\"/>';\n                \n }",
+       "$ xns" : "Roo.grid",
+       "* prop" : "cm[]",
+       "dataIndex" : "active"
+      },
+      {
+       "xtype" : "ColumnModel",
+       "header" : "Database Column",
+       "width" : 150,
+       "$ renderer" : "function(v) { return String.format('{0}', v); }",
+       "$ xns" : "Roo.grid",
+       "* prop" : "cm[]",
+       "dataIndex" : "dataIndex"
+      },
+      {
+       "xtype" : "ColumnModel",
+       "width" : 100,
+       "header" : "Type",
+       "$ renderer" : "function(v) { return String.format('{0}', v); }",
+       "$ xns" : "Roo.grid",
+       "* prop" : "cm[]",
+       "dataIndex" : "type"
+      },
+      {
+       "xtype" : "ColumnModel",
+       "header" : "Title",
+       "width" : 75,
+       "$ renderer" : "function(v) { return String.format('{0}', v); }",
+       "$ xns" : "Roo.grid",
+       "* prop" : "cm[]",
+       "dataIndex" : "title",
+       "items" : [
+        {
+         "xtype" : "GridEditor",
+         "$ xns" : "Roo.grid",
+         "* prop" : "editor",
+         "items" : [
+          {
+           "xtype" : "TextField",
+           "$ xns" : "Roo.form",
+           "* prop" : "field"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "xtype" : "ColumnModel",
+       "width" : 75,
+       "header" : "Width",
+       "$ renderer" : "function(v) { return String.format('{0}', v); }",
+       "$ xns" : "Roo.grid",
+       "* prop" : "cm[]",
+       "dataIndex" : "width",
+       "items" : [
+        {
+         "xtype" : "GridEditor",
+         "$ xns" : "Roo.grid",
+         "* prop" : "editor",
+         "items" : [
+          {
+           "xtype" : "NumberField",
+           "Number decimalPrecision" : 0,
+           "$ xns" : "Roo.form",
+           "* prop" : "field"
+          }
+         ]
+        }
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/resources/Editors/Editor.Roo.grid.Grid.js b/resources/Editors/Editor.Roo.grid.Grid.js
new file mode 100644 (file)
index 0000000..2c3ea1d
--- /dev/null
@@ -0,0 +1,226 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Roo.namespace('Editor.Roo.grid');
+
+Editor.Roo.grid.Grid = new Roo.XComponent({
+
+ _strings : {
+  '4ce58cbe362a5d7b156992a496d55bf3' :"Database Column",
+  'b78a3223503896721cca1303f776159b' :"Title",
+  '2f616612593df62aeed112de4f03110e' :"Edit a Grid",
+  '0ccc2bf3fb98387c23b6ca5500244d6e' :"Use ",
+  'c671c787b49f50a3ace9fdc5bd597825' :"core_enum",
+  '32954654ac8fe66a1d09be19001de2d4' :"Width",
+  'a1fa27779242b4902f7ae3bdd5c6d508' :"Type",
+  '6e7376dca68a2386a8737944196ab491' :"Create / Edit Grid"
+ },
+
+  part     :  ["Editors", "Grid" ],
+  order    : '001-Editor.Roo.grid.Grid',
+  region   : 'center',
+  parent   : false,
+  name     : "unnamed module",
+  disabled : false, 
+  permname : '', 
+  _tree : function()
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   grid : {
+    ds : {
+     '|xns' : 'Roo.data',
+     data : [
+       [ 1, 'test', 'test', 110 ]
+       
+     
+     ],
+     fields : [ 'active', 'dataIndex', 'type','title', 'width' ],
+     id : 'dataindex',
+     xns : Roo.data,
+     xtype : 'SimpleStore'
+    },
+    toolbar : {
+     '|xns' : 'Roo',
+     xns : Roo,
+     xtype : 'Toolbar',
+     items : [
+      {
+       '|xns' : 'Roo.Toolbar',
+       text : _this._strings['2f616612593df62aeed112de4f03110e'],
+       xns : Roo.Toolbar,
+       xtype : 'TextItem'
+      }
+     ]
+
+    },
+    '|xns' : 'Roo.grid',
+    autoExpandColumn : 'title',
+    clicksToEdit : 1,
+    loadMask : true,
+    xns : Roo.grid,
+    xtype : 'EditorGrid',
+    cm : [
+      {
+       '|xns' : 'Roo.grid',
+       dataIndex : 'active',
+       header : _this._strings['0ccc2bf3fb98387c23b6ca5500244d6e'],
+       renderer : function(v) {  
+           var state = v *1 > 0 ?  '-checked' : '';
+       
+           return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+                       
+        },
+       width : 75,
+       xns : Roo.grid,
+       xtype : 'ColumnModel'
+      },
+{
+       '|xns' : 'Roo.grid',
+       dataIndex : 'dataIndex',
+       header : _this._strings['4ce58cbe362a5d7b156992a496d55bf3'],
+       renderer : function(v) { return String.format('{0}', v); },
+       width : 150,
+       xns : Roo.grid,
+       xtype : 'ColumnModel'
+      },
+{
+       '|xns' : 'Roo.grid',
+       dataIndex : 'type',
+       header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'],
+       renderer : function(v) { return String.format('{0}', v); },
+       width : 100,
+       xns : Roo.grid,
+       xtype : 'ColumnModel'
+      },
+{
+       editor : {
+        field : {
+         '|xns' : 'Roo.form',
+         xns : Roo.form,
+         xtype : 'TextField'
+        },
+        '|xns' : 'Roo.grid',
+        xns : Roo.grid,
+        xtype : 'GridEditor',
+        items : [
+
+        ]
+
+       },
+       '|xns' : 'Roo.grid',
+       dataIndex : 'title',
+       header : _this._strings['b78a3223503896721cca1303f776159b'],
+       renderer : function(v) { return String.format('{0}', v); },
+       width : 75,
+       xns : Roo.grid,
+       xtype : 'ColumnModel',
+       items : [
+
+       ]
+
+      },
+{
+       editor : {
+        field : {
+         '|xns' : 'Roo.form',
+         decimalPrecision : 0,
+         xns : Roo.form,
+         xtype : 'NumberField'
+        },
+        '|xns' : 'Roo.grid',
+        xns : Roo.grid,
+        xtype : 'GridEditor',
+        items : [
+
+        ]
+
+       },
+       '|xns' : 'Roo.grid',
+       dataIndex : 'width',
+       header : _this._strings['32954654ac8fe66a1d09be19001de2d4'],
+       renderer : function(v) { return String.format('{0}', v); },
+       width : 75,
+       xns : Roo.grid,
+       xtype : 'ColumnModel',
+       items : [
+
+       ]
+
+      }
+    ],
+    listeners : {
+     cellclick : function (_self, rowIndex, columnIndex, e)
+      {
+      
+              var di = this.colModel.getDataIndex(columnIndex);
+              if (di != 'active') {
+                  return;
+              }
+               
+              var rec = _this.grid.ds.getAt(rowIndex);
+              
+              rec.set('active', rec.data.active * 1 ? 0 : 1);
+              rec.commit();
+               
+              
+      },
+     render : function() 
+      {
+          _this.grid = this; 
+          //_this.dialog = Pman.Dialog.FILL_IN
+          if (_this.panel.active) {
+             this.footer.onClick('first');
+          }
+      },
+     rowdblclick : function (_self, rowIndex, e)
+      {
+          if (!_this.dialog) return;
+          _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
+              _this.grid.footer.onClick('first');
+          }); 
+      }
+    },
+    items : [
+
+    ]
+
+   },
+   '|xns' : 'Roo',
+   background : false,
+   fitContainer : true,
+   fitToframe : true,
+   loadData : function(data) { 
+   
+        alert("IPC:TEST:" + JSON.stringify(data,null,4));
+       var ar = [];
+       for (var k in data) { 
+           var r = data[k];
+           ar.push([ false, r.Field, r.Type,  r.Field, 100] );
+       }
+       
+       alert("IPC:TEST:" + JSON.stringify(ar));
+       this.grid.dataSource.loadData(ar);
+   },
+   region : 'center',
+   tableName : 'core_enum',
+   title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
+   title : _this._strings['c671c787b49f50a3ace9fdc5bd597825'],
+   xns : Roo,
+   xtype : 'GridPanel',
+   listeners : {
+    activate : function() {
+         _this.panel = this;
+         if (_this.grid) {
+             _this.grid.footer.onClick('first');
+         }
+     }
+   },
+   items : [
+
+   ]
+
+  };  }
+});