user590586
user590586

Reputation: 3050

jqgrid filterToolbar search input size

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 -

UPDATE: It's height and width size .

Thank's In Advance.

Upvotes: 1

Views: 4180

Answers (1)

Oleg
Oleg

Reputation: 221997

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.

Upvotes: 7

Related Questions