如何在 ext-js 的文本框中添加图像

问题描述 投票:0回答:1

我使用以下代码创建了一个文本框。我想要这个文本框中的一个搜索图像我们怎样才能得到它?

So Basically I have created one Table with Footer so I want there one textbox inside the textbox search button should be there and on that button want to call other function.

I have made below changes still I am just getting normal textbox only. Not getting search button could you please check.

var ALIASGRID = new Ext.grid.EditorGridPanel({
                store : ALIASGRIDStore,
                stripeRows : true,
                hideHeaders : true,
                id : "ALIASGRID",
                region : 'center',
                clicksToEdit : 1,
                autoHeight : true,
                viewConfig : {
                    markDirty : false
                },
                columnLines : true,
                columns : [ {
                    id : 'Test',
                    header : 'Test',
                    dataIndex : 'Test',
                    width : 30,
                    editor: {
                    xtype: 'textfield',
                    triggers: {
                        search: {
                            cls: 'x-fa fa-search',
                            handler: function (field, trigger, eOpts) {}
                                }
                            }
                        },
                    renderer : renderTooltipAndId
                }],
                listeners : {
                    beforeedit : function(grid) {
                        if (!attributeMgrEnabled) {
                            return false;
                        }
                        // console.log(grid);
                    }
                }
            });
            
var ALIASFOOTER = new Ext.grid.EditorGridPanel({
                enableHdMenu : false,
                id : 'ALIASFOOTER',
                height : 19,
                store : ALIASFOOTERStore,
                columns : [ {
                    id : 'Test',
                    header : 'Testing.',
                    resizable : false,
                    width : 30
                }]});           
                
                
// Table that shows empty rows & a footer
            var layoutTable1 = new Ext.Panel({
                width : 470,
                items : [ ALIASGRID, ALIASFOOTER ],
                renderTo : 'AliasTable'
            });

Table

我不确定我们是否可以为这个文本框添加图像,因为这是一个表格,在那个表格里面对于一个文本框我想在里面搜索图像。

javascript node.js extjs
1个回答
0
投票

您可以为此目的使用触发器,请参阅文档

像这样更改列的

editor
配置(默认搜索触发图标看起来像一个组合框下拉选择器,这就是为什么我建议使用
cls
设置自定义图标;但您可以选择任何您想要的):

editor: {
    xtype: 'textfield',
    triggers: {
        search: {
            cls: 'x-fa fa-search',
            handler: function (field, trigger, eOpts) {}
        }
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.