Pman.Dialog.CoreAutoSavePreview.bjs
[Pman.Core] / Pman.Dialog.CoreAutoSavePreview.js
index 4d8e5dc..51dcd6a 100644 (file)
@@ -30,6 +30,14 @@ Pman.Dialog.CoreAutoSavePreview = {
         this.dialog = Roo.factory({
             xtype: 'LayoutDialog',
             xns: Roo,
+            listeners : {
+                show : function (_self)
+                {
+                    if(typeof(_this.data) != 'undefined'){
+                        _this.grid.footer.onClick('first');
+                    }
+                }
+            },
             background : false,
             closable : false,
             collapsible : false,
@@ -59,28 +67,56 @@ Pman.Dialog.CoreAutoSavePreview = {
                     grid : {
                         xtype: 'Grid',
                         xns: Roo.grid,
-                        autoExpandColumn : 'filename',
-                        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).data, function() {
-                                    _this.grid.footer.onClick('first');
-                                }); 
+                            
                             }
                         },
+                        autoExpandColumn : 'filename',
+                        loadMask : true,
+                        sm : {
+                            xtype: 'RowSelectionModel',
+                            xns: Roo.grid,
+                            listeners : {
+                                afterselectionchange : function (_self)
+                                {
+                                    var selected = this.getSelected();
+                                    
+                                    if (!selected) {
+                                        _this.viewPanel.setContent("Nothing Selected");
+                                        return;
+                                    }
+                                    Roo.log(selected);
+                                    _this.viewPanel.setContent("Data Selected");
+                                }
+                            },
+                            singleSelect : true
+                        },
                         dataSource : {
                             xtype: 'Store',
                             xns: Roo.data,
+                            listeners : {
+                                beforeload : function (_self, o)
+                                {
+                                    o.params = o.params || {};
+                                    
+                                    if(typeof(_this.data) == 'undefined'){
+                                        this.removeAll();
+                                        return false;
+                                    }
+                                    Roo.log(_this.data);
+                                    o.params.action = 'AUTOSAVE';
+                                }
+                            },
                             remoteSort : true,
                             sortInfo : { field : 'filename', direction: 'ASC' },
                             proxy : {
@@ -110,10 +146,8 @@ Pman.Dialog.CoreAutoSavePreview = {
                         footer : {
                             xtype: 'PagingToolbar',
                             xns: Roo,
-                            pageSize : 25,
-                            displayInfo : true,
-                            displayMsg : "Displaying Images{0} - {1} of {2}",
-                            emptyMsg : "No Images found"
+                            displayInfo : false,
+                            pageSize : 25
                         },
                         colModel : [
                             {