Pman.Dialog.AdminCoreEnum.bjs
[Pman.Admin] / Pman.Dialog.AdminCoreEnum.js
index 81cfe06..b2a90cd 100644 (file)
@@ -82,7 +82,7 @@ Pman.Dialog.AdminCoreEnum = {
                             },
                             afteredit : function (e)
                             {
-                               e.record.commit();     
+                             //  (function() {  e.record.commit(); }).defer(100);
                             },
                             cellclick : function (_self, rowIndex, columnIndex, e)
                             {
@@ -101,7 +101,18 @@ Pman.Dialog.AdminCoreEnum = {
                             },
                             beforeedit : function (e)
                             {
+                                Roo.log('before edit?');
+                                Roo.log(e);
+                                // force fill in of name first.. (Except when it's hidden)
+                                if (typeof(_this.data._hide_name) != 'undefined') { 
+                                    if(e.field == 'display_name' && e.record.data.is_system_enum*1 == 1){
+                                        return ;
+                                    }
+                             
+                                }
+                                
                                 if(e.field == 'name' && e.record.data.is_system_enum*1 == 1){
+                                    Roo.log("block name?");
                                     return false;
                                 }
                             }
@@ -126,11 +137,15 @@ Pman.Dialog.AdminCoreEnum = {
                                     if (operation != Roo.data.Record.COMMIT) {
                                         return;
                                     }
-                                    
-                                    var name = record.data.name;
+                                    Roo.log(record);
+                                
                                     if (typeof(_this.data._hide_name) != 'undefined') {
-                                        name =  record.data.display_name;
+                                        record.set('name', record.data.display_name);
+                                    }
+                                    if (!record.data.name.length) {
+                                        return;
                                     }
+                                    
                                     // got commit..
                                     new Pman.Request({
                                         url : baseURL + '/Roo/Core_enum.php',
@@ -138,7 +153,7 @@ Pman.Dialog.AdminCoreEnum = {
                                         params : {
                                             id : record.data.id,
                                             etype : _this.data.etype,
-                                            name : record.data.name,
+                                            name :  record.data.name,
                                             active : record.data.active,
                                             seqid : record.data.seqid,
                                             display_name : record.data.display_name
@@ -229,7 +244,10 @@ Pman.Dialog.AdminCoreEnum = {
                                               });
                                              var r = ds.data.length;
                                             ds.insert(r  , add);  
-                                            _this.grid.startEditing(r, 1); // name... 
+                                            
+                                            
+                                            
+                                           // _this.grid.startEditing(r, 1); // name... 
                                         }
                                     },
                                     cls : 'x-btn-text-icon',
@@ -343,12 +361,14 @@ Pman.Dialog.AdminCoreEnum = {
                         click : function (_self, e)
                         {
                             var sel = _this.grid.selModel.getSelectedCell();
-                            if (!sel) {
+                            if (!sel && _this.callback) {
                                 Roo.MessageBox.alert("Error", "Select an item");
                                 return;
                             }
-                            var rec = _this.grid.getAt(sel[0]);
+                            
+                        
                             if (_this.callback) {
+                                var rec = _this.grid.ds.getAt(sel[0]);
                                _this.callback(rec.data);
                            }
                            _this.dialog.hide();