Jqgrid switch filter toolbar with frozen column not working

I saw the following demo with a frozen column and filter toolbar here: http://www.ok-soft-gmbh.com/jqGrid/FrozenColumns.htm

Now for the same example, I want to implement a switch function that was available in the demo: http://www.ok-soft-gmbh.com/jqGrid/SimpleLocalGridWithSearchingToolbar1.htm

I tried, but it does not work. Can someone create a demo that has both a frozen column and a filter filter toolbar?


I tried to download the latest jqgrid code from github and tried to replicate the demo as follows (since u said the problem was fixed, I thought there was no need for the frozendiv, fixGBoxHeight functions in the demo that previously showed me, i.e. http: //www.ok-soft-gmbh.com/jqGrid/FrozenColumnsAndFilterToggle.htm )

    $grid.jqGrid({
        datatype: 'local',
        data: mydata,
        colNames: [/*'Id', */'Client', 'Date', 'Amount', 'Tax', 'Total', 'Closed', 'Shipped via', 'Notes'],
        colModel: [
            //{name: 'id', index: 'id', width: 45, align: 'center', sorttype: 'int', frozen: true},
            {name: 'name', index: 'name', width: 70, editable: true, frozen: true},
            {name: 'invdate', index: 'invdate', width: 80, align: 'center', sorttype: 'date',
                formatter: 'date', formatoptions: {newformat: 'm/d/Y'}, datefmt: 'm/d/Y'},
            {name: 'amount', index: 'amount', width: 75, formatter: 'number', align: 'right', editable: true},
            {name: 'tax', index: 'tax', width: 50, formatter: 'number',
                formatoptions: {decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 4, defaultValue: '0.0000'},
                align: 'right', editable: true, editoptions: {readonly: true}},
            {name: 'total', index: 'total', width: 60, formatter: 'number', align: 'right', editable: true},
            {name: 'closed', index: 'closed', width: 70, align: 'center', editable: true,
                formatter: 'checkbox', edittype: 'checkbox', editoptions: {value: 'Yes:No', defaultValue: 'Yes'}},
            {name: 'ship_via', index: 'ship_via', width: 100, align: 'center', formatter: 'select', editable: true,
                edittype: 'select', editoptions: {value: 'FE:FedEx;TN:TNT;IN:Intim', defaultValue: 'Intime'}},
            {name: 'note', index: 'note', width: 70, sortable: false, editable: true}
        ],
        rowNum: 10,
        rowList: [5, 10, 20],
        pager: '#pager',
        gridview: true,
        rownumbers: true,
        sortname: 'invdate',
        viewrecords: true,
        sortorder: 'desc',
        caption: 'Frozen columns with dynamic shown filter toolbar',
        height: '100%',
        shrinkToFit: false,
        width: 550,
        resizeStop: function () {
            /*resizeColumnHeader.call(this);
            fixPositionsOfFrozenDivs.call(this);
            fixGboxHeight.call(this);*/
        },
        loadComplete: function () {
            //fixPositionsOfFrozenDivs.call(this);
        }
    });
    $grid.jqGrid('navGrid', '#pager', {add: false, edit: false, del: false}, {}, {}, {},
        {multipleSearch: true, overlay: 0});
    $grid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch: 'cn'});
    $grid.jqGrid('navButtonAdd', '#pager', {
        caption: "Filter",
        title: "Toggle Searching Toolbar",
        buttonicon: 'ui-icon-pin-s',
        onClickButton: function () {
            this.toggleToolbar();
            /*if ($.isFunction(this.p._complete)) {
                if ($('.ui-search-toolbar', this.grid.hDiv).is(':visible')) {
                    $('.ui-search-toolbar', this.grid.fhDiv).show();
                } else {
                    $('.ui-search-toolbar', this.grid.fhDiv).hide();
                }
                this.p._complete.call(this);
                fixPositionsOfFrozenDivs.call(this);
            }*/
        }
    });
    $grid[0].toggleToolbar();
    /*$grid.jqGrid('gridResize', {
        minWidth: 450,
        stop: function () {
            fixPositionsOfFrozenDivs.call($grid[0]);
            fixGboxHeight.call($grid[0]);
        }
    });
    resizeColumnHeader.call($grid);*/
    $grid.jqGrid('setFrozenColumns');
    /*$grid.p._complete.call($grid);
    fixPositionsOfFrozenDivs.call($grid);*/
});

But still, the code will not work, and filtertoolbar does not work as in the previous demo (http://www.ok-soft-gmbh.com/jqGrid/FrozenColumnsAndFilterToggle.htm)

+5
source share
1 answer

First of all, I recommend that you use the demo from the answer as the basis instead of the demo from the previous answer .

. . toggleToolbar.

, . , . , :

$grid.jqGrid('filterToolbar', {stringResult: true, searchOnEnter: true, defaultSearch: 'cn'});
$grid.jqGrid('navButtonAdd', '#pager', {
    caption: "Filter",
    title: "Toggle Searching Toolbar",
    buttonicon: 'ui-icon-pin-s',
    onClickButton: function () {
        this.toggleToolbar();
        if ($.isFunction(this.p._complete)) {
            if ($('.ui-search-toolbar', this.grid.hDiv).is(':visible')) {
                $('.ui-search-toolbar', this.grid.fhDiv).show();
            } else {
                $('.ui-search-toolbar', this.grid.fhDiv).hide();
            }
            this.p._complete.call(this);
            fixPositionsOfFrozenDivs.call(this);
        }
    }
});
$grid[0].toggleToolbar();
+3

All Articles