Free-JqGrid:autowidth在Panel Bootstrap中不起作用

时间:2016-07-20 14:45:44

标签: javascript jquery twitter-bootstrap jqgrid free-jqgrid

我在Panel Bootstrap中有一个jqGrid,我无法找到autowidth:true参数无效的原因。这是jqGrid代码:

    grid.jqGrid({
        data: myData,
        datatype:'local',
        noDataContent: "Aucune données présente..",
        loadMessage: "Merci de patienter...",
        styleUI : 'Bootstrap',
        colNames: ["Liste des rubriques","Taux Sal","Taux Pat"],
        colModel: [
            {
                name: "Libelle", template: 'string'
            },
            {
                name: "txsalrub", template: 'integer',formatter:'number', formatoptions: {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}
            },
            {
                name: "txpatrub", template: 'integer',formatter:'number', formatoptions: {decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}
            }
            ],
        // loadonce: true,
        autowidth:true,
        // width: 'auto',
        maxHeight: height
        // width: null,
        shrinkToFit: false,
        // cmTemplate: { autoResizable: true },
        // autoResizing: { compact: true },
        // autoresizeOnLoad: true
    });

以下是我的结果:

Free JqGrid autowidth not working

我尝试了很多解决方案,但没有任何效果:/

1 个答案:

答案 0 :(得分:0)

这是我网格中的代码

var grid = $("#decompteUser");
        grid.jqGrid('setGridParam', { data: myData })
            .trigger('reloadGrid', [{ page: 1}]);
        grid.jqGrid({
            data: myData,
            datatype:'local',
            guiStyle: "bootstrap",
            iconSet: "fontAwesome",
            colNames: ["N°décompte","Nbj Payés","Brut Payé","Net Payé","Net Imposable","N° Chèque","Date", "Date Paiement"],
            colModel: [
                {
                    name: "iddec", template: 'string'
                },
                {
                    name: "nbjpayedec", template: 'integer',formatter:'currency', formatoptions:{decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, suffix: " J"}
                },
                {
                    name: "mtbrutdec", template: 'integer',formatter:'currency', formatoptions:{decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, suffix: " €"}
                },
                {
                    name: "mtnetdec", template: 'integer',formatter:'currency', formatoptions:{decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, suffix: " €"}
                },
                {
                    name: "mtnetimposdec", template: 'integer',formatter:'currency', formatoptions:{decimalSeparator:",", thousandsSeparator: " ", decimalPlaces: 2, suffix: " €"}
                },
                {
                    name: "numchequedec", template: 'integer'
                },
                {
                    name: "dteditdec", template: 'string',formatter:'date', formatoptions:{srcformat: 'Y/m/d', newformat: 'd/m/Y'}
                },
                {
                    name: "dtpaiementdec", template: 'string',formatter:'date', formatoptions:{srcformat: 'Y/m/d', newformat: 'Y'}
                }
                ],
            maxHeight: height,
            width:width,
            grouping:true,
            groupingView: {
                groupField : ['dtpaiementdec'],
                groupOrder: 'desc',
                groupColumnShow : true,
                groupText: ['Année : <b>{0}</b>']
            }
        });
        $("#decompteUser").jqGrid('setGridParam',{datatype:'local'}).trigger('reloadGrid');

Result of JqGrid