From: Alan Knowles Date: Fri, 17 Apr 2015 08:57:05 +0000 (+0800) Subject: resources/Editors/Editor.Roo.grid.Grid.bjs X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=5f9d7e1548984d7f09ba2da4859659b07851da54;p=app.Builder.js resources/Editors/Editor.Roo.grid.Grid.bjs resources/Editors/Editor.Roo.grid.Grid.js --- diff --git a/resources/Editors/Editor.Roo.grid.Grid.bjs b/resources/Editors/Editor.Roo.grid.Grid.bjs index 1bb1c83e6..eb5fb4a51 100644 --- a/resources/Editors/Editor.Roo.grid.Grid.bjs +++ b/resources/Editors/Editor.Roo.grid.Grid.bjs @@ -20,9 +20,9 @@ "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, + "| 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 var has_s = typeof(r.relates_to_schema) != 'undefined'\n ar.push([ !has_s , r.Field, r.Type, r.Field, 100] );\n if (!has_s) {\n continue;\n }\n for (var kk in r.relates_to_schmea) { \n var rr = r.relates_to_schmea[kk];\n if (rr.Field == r.relates_to_col) {\n continue;\n }\n ar.push([ false, r.Field + '_'+ rr.Field, rr.Type, rr.Field, 100] );\n }\n }\n \n alert(\"IPC:TEST:\" + JSON.stringify(ar));\n this.grid.dataSource.loadData(ar);\n}", "fitToframe" : true, + "background" : false, "region" : "center", "title" : "core_enum", "xtype" : "GridPanel", @@ -34,8 +34,8 @@ { "listeners" : { "|rowdblclick" : "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n \n}\n", - "|render" : "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\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}" + "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}", + "|render" : "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n\n}" }, "Number clicksToEdit" : 1, "autoExpandColumn" : "title", @@ -66,8 +66,8 @@ }, { "xtype" : "ColumnModel", - "width" : 75, "header" : "Use ", + "width" : 75, "$ renderer" : "function(v) { \n var state = v *1 > 0 ? '-checked' : '';\n\n return '';\n \n }", "$ xns" : "Roo.grid", "* prop" : "cm[]", @@ -75,8 +75,8 @@ }, { "xtype" : "ColumnModel", - "header" : "Database Column", "width" : 150, + "header" : "Database Column", "$ renderer" : "function(v) { return String.format('{0}', v); }", "$ xns" : "Roo.grid", "* prop" : "cm[]", @@ -84,8 +84,8 @@ }, { "xtype" : "ColumnModel", - "width" : 100, "header" : "Type", + "width" : 100, "$ renderer" : "function(v) { return String.format('{0}', v); }", "$ xns" : "Roo.grid", "* prop" : "cm[]", @@ -93,8 +93,8 @@ }, { "xtype" : "ColumnModel", - "header" : "Title", "width" : 75, + "header" : "Title", "$ renderer" : "function(v) { return String.format('{0}', v); }", "$ xns" : "Roo.grid", "* prop" : "cm[]", @@ -116,8 +116,8 @@ }, { "xtype" : "ColumnModel", - "width" : 75, "header" : "Width", + "width" : 75, "$ renderer" : "function(v) { return String.format('{0}', v); }", "$ xns" : "Roo.grid", "* prop" : "cm[]", diff --git a/resources/Editors/Editor.Roo.grid.Grid.js b/resources/Editors/Editor.Roo.grid.Grid.js index 420e5b310..95e0ccf55 100644 --- a/resources/Editors/Editor.Roo.grid.Grid.js +++ b/resources/Editors/Editor.Roo.grid.Grid.js @@ -194,7 +194,18 @@ Editor.Roo.grid.Grid = new Roo.XComponent({ var ar = []; for (var k in data) { var r = data[k]; - ar.push([ false, r.Field, r.Type, r.Field, 100] ); + var has_s = typeof(r.relates_to_schema) != 'undefined' + ar.push([ !has_s , r.Field, r.Type, r.Field, 100] ); + if (!has_s) { + continue; + } + for (var kk in r.relates_to_schmea) { + var rr = r.relates_to_schmea[kk]; + if (rr.Field == r.relates_to_col) { + continue; + } + ar.push([ false, r.Field + '_'+ rr.Field, rr.Type, rr.Field, 100] ); + } } alert("IPC:TEST:" + JSON.stringify(ar));