Pman.Dialog.CoreAutoSavePreview.bjs
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.bjs
index b810864..da87137 100644 (file)
@@ -6,6 +6,9 @@
     "path": "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreAutoSavePreview.bjs",
     "items": [
         {
+            "listeners": {
+                "show": "function (_self)\n{\n    if(typeof(_this.data) != 'undefined'){\n        _this.grid.footer.onClick('first');\n    }\n}"
+            },
             "background": false,
             "closable": false,
             "collapsible": false,
                             "|xns": "Roo.grid",
                             "items": [
                                 {
+                                    "listeners": {
+                                        "afterselectionchange": "function (_self)\n{\n    var selected = this.getSelected();\n    \n    if (!selected) {\n        _this.viewPanel.setContent(\"Nothing Selected\");\n        return;\n    }\n    \n    _this.viewPanel.load( { url : baseURL + \"/Roo/Events\", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){\n        \n        var res = Roo.decode(oResponse.responseText);\n        \n        if(!bSuccess || !res.success){\n            _this.viewPanel.setContent(\"Load data failed?!\");\n        }\n\n        if(typeof(res.data) !== 'string'){\n            _this.viewPanel.setContent(res.data);\n            return;\n        }\n        \n        _this.source = res.data.POST.source;\n        Roo.log(_this.source);\n        _this.viewPanel.setContent(_this.source);\n        \n    });\n}"
+                                    },
+                                    "*prop": "sm",
+                                    "singleSelect": true,
+                                    "xtype": "RowSelectionModel",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "listeners": {
+                                        "beforeload": "function (_self, o)\n{\n    o.params = o.params || {};\n    \n    if(typeof(_this.data) == 'undefined'){\n        this.removeAll();\n        return false;\n    }\n    Roo.log(_this.data);\n    o.params.action = 'AUTOSAVE';\n}"
+                                    },
                                     "*prop": "dataSource",
-                                    "xtype": "Store",
                                     "remoteSort": true,
-                                    "|sortInfo": "{ field : 'filename', direction: 'ASC' }",
+                                    "xtype": "Store",
+                                    "|sortInfo": "{ field : 'event_when', direction: 'DESC' }",
                                     "|xns": "Roo.data",
                                     "items": [
                                         {
                                             "*prop": "proxy",
-                                            "xtype": "HttpProxy",
                                             "method": "GET",
-                                            "|url": "baseURL + '/Roo/Images.php'",
+                                            "xtype": "HttpProxy",
+                                            "|url": "baseURL + '/Roo/Events.php'",
                                             "|xns": "Roo.data"
                                         },
                                         {
                     "listeners": {
                         "render": "function (_self)\n{\n    _this.viewPanel = _self;\n}"
                     },
+                    "autoScroll": true,
                     "background": false,
                     "fitContainer": true,
                     "fitToFrame": true,