DataObjects/Core_person_signup.php
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.js
index 0a8e141..1c9b595 100644 (file)
@@ -36,6 +36,7 @@ Pman.Dialog.CoreAutoSavePreview = {
                     if(typeof(_this.data) != 'undefined'){
                         _this.grid.footer.onClick('first');
                     }
+                    
                 }
             },
             background : false,
@@ -62,8 +63,8 @@ Pman.Dialog.CoreAutoSavePreview = {
                     fitContainer : true,
                     fitToframe : true,
                     region : 'west',
-                    tableName : 'Images',
-                    title : "Images",
+                    tableName : 'Events',
+                    title : "Events",
                     grid : {
                         xtype: 'Grid',
                         xns: Roo.grid,
@@ -87,15 +88,15 @@ Pman.Dialog.CoreAutoSavePreview = {
                                 {
                                     var selected = this.getSelected();
                                     
-                                    if (!selected) {
-                                        _this.viewPanel.setContent("Nothing Selected");
-                                        return;
+                                    _this.source = '';
+                                    
+                                    if(!selected){
+                                       _this.viewPanel.setContent("Please select an saved version on the left"); 
+                                       return;
                                     }
                                     
                                     _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){
@@ -134,11 +135,20 @@ Pman.Dialog.CoreAutoSavePreview = {
                                         return false;
                                     }
                                 
-                                    var d = _this.data;
+                                    var d = Roo.apply({}, _this.data);
                                     delete d.successFn;
-                                    
+                                
                                     Roo.apply(o.params, d);
                                     
+                                },
+                                load : function (_self, records, options)
+                                {
+                                    var sm = _this.grid.getSelectionModel();
+                                    if (!sm.getSelections().length) {
+                                        sm.selectFirstRow();
+                                        
+                                        sm.fireEvent('afterselectionchange', sm);
+                                    }
                                 }
                             },
                             remoteSort : true,
@@ -230,7 +240,7 @@ Pman.Dialog.CoreAutoSavePreview = {
                         
                             _this.dialog.hide();
                             
-                            if (_this.callback) {
+                            if (_this.callback && _this.source != '') {
                                 _this.callback.call(this, _this.source);
                             }
                         }