ParamQuery grid support forum
General Category => ParamQuery Pro Evaluation Support => Topic started by: akraines on July 25, 2019, 09:02:14 pm
-
Is it possible to customise the implementation of the Autofit option?
I'd like to make the autofit function take into account column header and data width to determine an optimal the width of the columns.
-
Autofit logic can't be customized and it doesn't need to because it already considers the cell widths in table body and header.
It can be configured with flex option https://paramquery.com/pro/api#option-flex
-
Perfect!
Thanks
-
The flex option works very well except that it seems to put all the remaining space in the last column. Am I doing something wrong?
height:"500",
width:"100%",
colModel,
scrollModel: { autoFit: true },
groupModel,
groupOption: function( event, {ui, oldGM, source} ) {
const groupModel = this.option("groupModel");
toggleGroupColumnsVisible( groupModel.dataIndx);
},
flex: { on: true },
function toggleGroupColumnsVisible(groupColumns) {
const showGroupColumn = _.isArray(groupColumns) ? groupColumns.length > 0 : groupColumns;
colModel = showGroupColumn ? [groupColumn, ...colModelFromServer] : colModelFromServer;
if (_.isArray(groupColumns)){
const columnsToHide = new Set(groupColumns);
_.map(colModel, c => c.hidden = columnsToHide.has(c.dataIndx))
}
pqGridInstance.option( "colModel", colModel );
pqGridInstance.refreshView(colModel);
pqGridInstance.flex();
}
-
It's because of scrollModel: { autoFit: true }
you may need to comment/ remove it.
-
But then it doesn't take 100% width. I'd like it to share the remaining space between all the columns. The truth is that I'd prefer to have autofit false since it makes coulummn resizing work unnaturaly - is there a way to make it use 100% space when flex is true without using autofit.
Thanks.