Javascript JQGrid默认搜索对话框,输入字段宽度
Jqgrid默认搜索对话框中是否有任何选项可用于增加搜索中文本框的宽度 图为: 更新的我的搜索代码如下:Javascript JQGrid默认搜索对话框,输入字段宽度,javascript,jquery,css,jqgrid,Javascript,Jquery,Css,Jqgrid,Jqgrid默认搜索对话框中是否有任何选项可用于增加搜索中文本框的宽度 图为: 更新的我的搜索代码如下: jQuery("#subscriptions").jqGrid( 'navGrid', '#pager', { del: false, add: false, edit: false }, {}, {}, {}, { multipleSearch: true, closeAfterSearch: tru
jQuery("#subscriptions").jqGrid(
'navGrid',
'#pager',
{ del: false, add: false, edit: false },
{},
{},
{},
{
multipleSearch: true,
closeAfterSearch: true,
beforeShowSearch: function ($form) {
$(".searchFilter table td .input-elm").attr('style', 'width:400px');
$('#searchmodfbox_subscriptions').width(750);
return true;
},
afterRedraw: function ($form) {
$(".searchFilter table td .input-elm").attr('style', 'width:400px');
return true;
}
});
我还在我的网格中使用loadonce选项作为true,因此我的所有搜索都是本地的,不会进行服务器调用。您应该使用beforeShowSearch和afterRedraw事件更改样式 beforeShowSearch每次启动搜索对话框之前都会触发 当添加新的搜索参数时,显示并触发afterRedraw 我已经用它修改了代码<代码>$(“.searchFilter表td.input elm”) 其中,searchFilter是父div的类,input elm是文本框的类。300px只是我给出的一个数字,请随意更改以适应您的更改:
jQuery("#subscriptions").jqGrid(
'navGrid',
'#pager',
{ del: false, add: false, edit: false },
{},
{},
{},
{
multipleSearch: true,
closeAfterSearch: true,
beforeShowSearch: function($form) {
$(".searchFilter table td .input-elm").attr('style','width:300px');
return true;
},
afterRedraw: function($form) {
$(".searchFilter table td .input-elm").attr('style','width:300px');
return true;
}
});
谢谢@avijendr,但是在添加beforeShowSearch之后,我的搜索对话框没有打开。我检查了chrome控制台,也没有错误。@nido-这是jqgrid(在4.4中引入)中的一个bug。我更新了答案,您必须在BeforeShow搜索中返回true。请让我知道这是否有效。它在本地对我有效!还有一件事;这是它第一次增加了输入字段的长度,但当我更改搜索条件时,它将其移回原来的大小,是否可以全部更新?@nido我很快会回来的。@nido我已经用解决方案更新了答案。该技巧由“afterRedraw”事件完成。我建议您保留一个用于更改大小的通用函数,并在两个事件中调用它。