jqgrid filterToolbar搜索输入大小 [英] jqgrid filterToolbar search input size

查看:249
本文介绍了jqgrid filterToolbar搜索输入大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始使用filtertoolbar:myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: false, defaultSearch : "cn"});

I'm starting to use filtertoolbar: myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: false, defaultSearch : "cn"});

我的问题是,是否可以控制搜索输入的大小-

My question Is If I can control the search inputs size -

更新:高度和宽度大小.

感谢提前.

推荐答案

如果我理解您的要求是正确的,则应在colModel列的定义中包括您希望限制该选项的输入大小

If I understand you correct you should include in colModel in the definition of the column which input size you want to restrict the option like

searchoptions:{ attr: {maxlength: 5}}

在该示例中,搜索工具栏的相应输入字段将被允许输入不超过五个字符.

In the example in the corresponding input field of the searching toolbar will be allowed to type not more as five characters.

更新:我不明白为什么需要这种行为,但是您可以使用searchoptions中的dataInit来设置输入控件的高度和宽度.为此,您可以使用jQuery.css或jQuery.height和jQuery.width方法:

UPDATED: I don't understand why you need such behavior, but you can use dataInit of the searchoptions to set height and width of the input control. To do this you can use either jQuery.css or jQuery.height and jQuery.width methods:

searchoptions:{
    attr: {maxlength: 5},
    dataInit: function(elem) {
        //$(elem).css({height:"30px", width:"40px"});
        $(elem).height(30).width(40);
    }
}

如果在搜索工具栏中增加控件的高度,则应另外进行更改

If you increase the height of the control in the searching toolbar you should change additionally

var myGrid = $("#list");
// ...
var $search_toolbar = $("tr.ui-search-toolbar", myGrid[0].grid.hDiv);
$search_toolbar.height(30);

您当然应该在调用创建搜索工具栏的filterToolbar之后执行此操作.

You should do this of course after the call of filterToolbar which create the searching toolbar.

此处中查看小型演示.

这篇关于jqgrid filterToolbar搜索输入大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆