Pman.Dialog.CoreAutoSavePreview.bjs
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.js
index 8c6c548..bb95ff7 100644 (file)
@@ -75,13 +75,9 @@ Pman.Dialog.CoreAutoSavePreview = {
                                 if (_this.panel.active) {
                                    this.footer.onClick('first');
                                 }
-                            },
-                            rowdblclick : function (_self, rowIndex, e)
-                            {
-                            
                             }
                         },
-                        autoExpandColumn : 'filename',
+                        autoExpandColumn : 'event_when',
                         loadMask : true,
                         sm : {
                             xtype: 'RowSelectionModel',
@@ -95,8 +91,32 @@ Pman.Dialog.CoreAutoSavePreview = {
                                         _this.viewPanel.setContent("Nothing Selected");
                                         return;
                                     }
-                                    Roo.log(selected);
-                                    _this.viewPanel.load( { url : baseURL + "/Roo/Events", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1});
+                                    
+                                    _this.viewPanel.load( { url : baseURL + "/Roo/Events", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){
+                                        
+                                        _this.source = '';
+                                        
+                                        var res = Roo.decode(oResponse.responseText);
+                                        
+                                        if(!bSuccess || !res.success){
+                                            _this.viewPanel.setContent("Load data failed?!");
+                                        }
+                                        
+                                        if(typeof(res.data) === 'string'){
+                                            _this.viewPanel.setContent(res.data);
+                                            return;
+                                        }
+                                        
+                                        if(!_this.data.successFn){
+                                            Roo.MessageBox.alert('Error', 'Please setup the successFn');
+                                            return;
+                                        }
+                                        
+                                        _this.source = _this.data.successFn(res);
+                                
+                                        _this.viewPanel.setContent(_this.source);
+                                        
+                                    });
                                 }
                             },
                             singleSelect : true
@@ -170,6 +190,7 @@ Pman.Dialog.CoreAutoSavePreview = {
                             _this.viewPanel = _self;
                         }
                     },
+                    autoScroll : true,
                     background : false,
                     fitContainer : true,
                     fitToFrame : true,
@@ -202,7 +223,12 @@ Pman.Dialog.CoreAutoSavePreview = {
                     xns: Roo,
                     listeners : {
                         click : function() {
+                        
                             _this.dialog.hide();
+                            
+                            if (_this.callback) {
+                                _this.callback.call(this, _this.source);
+                            }
                         }
                     },
                     text : "OK"