我在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
我尝试了很多解决方案,但没有任何效果:/
答案 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');