Эх сурвалжийг харах

放大镜回车事件触发

zhuth 7 жил өмнө
parent
commit
67a8275f4c

+ 25 - 1
frontend/saas-web/app/view/core/dbfind/DbfindGridPanel.js

@@ -55,7 +55,7 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
                 dockedItems:[{
                     xtype:'toolbar',
                     dock:'top',
-                    items:me.dbSearchFields.concat([{
+                    items:me.getSearchFields().concat([{
                         xtype:'button',
                         text:'查询',
                         handler:function(b){
@@ -136,6 +136,30 @@ Ext.define('saas.view.core.dbfind.DbfindGridPanel', {
         });
     },
 
+    getSearchFields: function() {
+        var me = this,
+        searchFields = me.dbSearchFields;
+
+        Ext.Array.each(searchFields, function(f) {
+            f.enableKeyEvents = true;
+            f.listeners = {
+                keydown: function(th, e, eOpts) {
+                    if(e.keyCode == 13) {
+                        me.condition = '', items = [];
+                        Ext.Array.each(searchFields,function(f) {
+                            var field = th.ownerCt.down('[name='+f.name+']')
+                            items.push(field);
+                        });
+                        me.condition = me.getCondition(items);
+                        me.store.loadPage(1);
+                    }
+                }
+            }
+        });
+
+        return searchFields;
+    },
+
     /**
      * 获得过滤条件
      */

+ 25 - 1
frontend/saas-web/app/view/core/dbfind/MultiDbfindGridPanel.js

@@ -82,7 +82,7 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
                 dockedItems:[{
                     xtype:'toolbar',
                     dock:'top',
-                    items:me.dbSearchFields.concat([{
+                    items:me.getSearchFields().concat([{
                         xtype:'button',
                         text:'查询',
                         handler:function(b){
@@ -265,6 +265,30 @@ Ext.define('saas.view.core.dbfind.MultiDbfindGridPanel', {
         me.callParent(arguments);
     },
 
+    getSearchFields: function() {
+        var me = this,
+        searchFields = me.dbSearchFields;
+
+        Ext.Array.each(searchFields, function(f) {
+            f.enableKeyEvents = true;
+            f.listeners = {
+                keydown: function(th, e, eOpts) {
+                    if(e.keyCode == 13) {
+                        me.condition = '', items = [];
+                        Ext.Array.each(searchFields,function(f) {
+                            var field = th.ownerCt.down('[name='+f.name+']')
+                            items.push(field);
+                        });
+                        me.condition = me.getCondition(items);
+                        me.store.loadPage(1);
+                    }
+                }
+            }
+        });
+
+        return searchFields;
+    },
+
      /**
      * 获得过滤条件
      */