Pman.Tab.BuilderPalette.js
authorAlan Knowles <alan@akkbhome.com>
Thu, 16 Dec 2010 13:55:40 +0000 (21:55 +0800)
committerAlan Knowles <alan@akkbhome.com>
Thu, 16 Dec 2010 13:55:40 +0000 (21:55 +0800)
Pman.Tab.BuilderPalette.js

index c227083..2b8669e 100644 (file)
@@ -1 +1,201 @@
-0
\ No newline at end of file
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+
+
+// register the module first
+Pman.on('beforeload', function()
+{
+    Pman.register({
+        modKey : '001-Pman.Tab.BuilderPalette',
+        module : Pman.Tab.BuilderPalette,
+        region : 'east',
+        parent : Pman.Tab.BuilderTab,
+        name : "Pman.Tab.BuilderPalette",
+        disabled : false, 
+        permname: '' 
+    });
+});
+
+Pman.Tab.BuilderPalette = new Roo.util.Observable({
+
+    panel : false,
+    disabled : false,
+    parentLayout:  false,
+
+    add : function(parentLayout, region)
+    {
+
+        var _this = this;
+        this.parentLayout = parentLayout;
+
+        this.panel = parentLayout.addxtype({
+            xtype: 'GridPanel',
+            xns: Roo,
+            title : "ris_location",
+            fitToframe : true,
+            fitContainer : true,
+            tableName : 'ris_location',
+            background : true,
+            region : 'center',
+            listeners : {
+                activate : function() {
+                    _this.panel = this;
+                    if (_this.grid) {
+                        _this.grid.footer.onClick('first');
+                    }
+                }
+            },
+            grid : {
+                xtype: 'Grid',
+                xns: Roo.grid,
+                autoExpandColumn : 'name',
+                loadMask : true,
+                listeners : {
+                    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');
+                        }); 
+                    }
+                },
+                dataSource : {
+                    xtype: 'Store',
+                    xns: Roo.data,
+                    remoteSort : true,
+                    sortInfo : { field : 'name', direction: 'ASC' },
+                    proxy : {
+                        xtype: 'HttpProxy',
+                        xns: Roo.data,
+                        method : 'GET',
+                        url : baseURL + '/Roo/ris_location.php'
+                    },
+                    reader : {
+                        xtype: 'JsonReader',
+                        xns: Roo.data,
+                        totalProperty : 'total',
+                        root : 'data',
+                        id : 'id',
+                        fields : [
+                            {
+                                'name': 'id',
+                                'type': 'int'
+                            },
+                            {
+                                'name': 'name',
+                                'type': 'string'
+                            },
+                            {
+                                'name': 'country',
+                                'type': 'string'
+                            }
+                        ]
+                    }
+                },
+                footer : {
+                    xtype: 'PagingToolbar',
+                    xns: Roo,
+                    pageSize : 25,
+                    displayInfo : true,
+                    displayMsg : 'Displaying ris_location{0} - {1} of {2}',
+                    emptyMsg : 'No ris_location found'
+                },
+                toolbar : {
+                    xtype: 'Toolbar',
+                    xns: Roo,
+                    items : [
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            text : "Add",
+                            cls : 'x-btn-text-icon',
+                            icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+                            listeners : {
+                                click : function()
+                                {
+                                    if (!_this.dialog) return;
+                                    _this.dialog.show( { id : 0 } , function() {
+                                        _this.grid.footer.onClick('first');
+                                   }); 
+                                }
+                            }
+                        },
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            text : "Edit",
+                            cls : 'x-btn-text-icon',
+                            icon : Roo.rootURL + 'images/default/tree/leaf.gif',
+                            listeners : {
+                                click : function()
+                                {
+                                    var s = _this.grid.getSelectionModel().getSelections();
+                                    if (!s.length || (s.length > 1))  {
+                                        Roo.MessageBox.alert("Error", s.length ? "Select only one Row" : "Select a Row");
+                                        return;
+                                    }
+                                    if (!_this.dialog) return;
+                                    _this.dialog.show(s[0].data, function() {
+                                        _this.grid.footer.onClick('first');
+                                    }); 
+                                    
+                                }
+                            }
+                        },
+                        {
+                            xtype: 'Button',
+                            xns: Roo.Toolbar,
+                            text : "Delete",
+                            cls : 'x-btn-text-icon',
+                            icon : rootURL + '/Pman/templates/images/trash.gif',
+                            listeners : {
+                                click : function()
+                                {
+                                     Pman.genericDelete(_this, 'ris_location'); 
+                                }
+                            }
+                        }
+                    ]
+                },
+                colModel : [
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        header : 'Id',
+                        width : 75,
+                        dataIndex : 'id',
+                        renderer : function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        header : 'Name',
+                        width : 200,
+                        dataIndex : 'name',
+                        renderer : function(v) { return String.format('{0}', v); }
+                    },
+                    {
+                        xtype: 'ColumnModel',
+                        xns: Roo.grid,
+                        header : 'Country',
+                        width : 200,
+                        dataIndex : 'country',
+                        renderer : function(v) { return String.format('{0}', v); }
+                    }
+                ]
+            }
+        });
+        this.layout = this.panel.layout;
+
+    }
+});