开发者

jqgrid filterToolbar search input size

I'm starting to use filtertoolbar: myGrid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: false, de开发者_如何学CfaultSearch : "cn"});

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

UPDATE: It's height and width size .

Thank's In Advance.


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.

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);

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

See small demo here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜