Sfoglia il codice sorgente

combogrid 固定检索框

luoyifan 3 anni fa
parent
commit
bc91a6be11
1 ha cambiato i file con 28 aggiunte e 1 eliminazioni
  1. 28 1
      src/controls/input/combogrid.js

+ 28 - 1
src/controls/input/combogrid.js

@@ -146,6 +146,23 @@ export default function () {
                     {
                         ...comboGridPicker,
                         ...me.grid,
+                        tbar: {
+                            xtype: 'toolbar',
+                            items: [
+                                {xtype: 'textfield', fieldLabel: '筛选'},
+                                {
+                                    xtype: 'button',
+                                    text: '查询',
+                                    iconCls: 'x-fa fa-search',
+                                    cssType: 'primary',
+                                    listeners: {
+                                        click: () => {
+                                            me.reloadGrid()
+                                        }
+                                    }
+                                },
+                            ]
+                        },
                         autoLoad: false,
                         listeners: {
                             afterrender(grid) {
@@ -256,10 +273,20 @@ export default function () {
         onExpand() {
             // 展开时,根据 lookup 带入查询参数
             const expressData = this.getExpressData()
+            const txtField = this.grid.down('toolbar').down('textfield')
+            txtField.setValue(expressData.queryValue)
+            this.reloadGrid()
+        },
+
+        reloadGrid() {
+            // 展开时,根据 lookup 带入查询参数
+            const expressData = this.getExpressData()
             const reloadParam = calcObjectFlat(expressData, this.param)
 
+            const txtField = this.grid.down('toolbar').down('textfield')
+
             // 每个 combogrid 默认带上 __queryValue 属性
-            reloadParam["__queryValue"] = expressData.queryValue
+            reloadParam["__queryValue"] = txtField.getValue()
             this.grid.reload(reloadParam)
         },