ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: queensgambit9 on December 05, 2018, 08:47:26 pm
-
Would it be possible to only export visible columns (5.6.0)?
-
By default, visible columns are visible and hidden columns are hidden in Excel export.
If you want the hidden columns to remove altogether from Excel export, then
1) for non - grouped columns: you have to add copy: false to the hidden columns.
2) for grouped columns, you have to remove hidden columns from colModel in beforeExport event and restore original colModel in export event.
-
Having issue to get it right (column titles seems mixed up)...
beforeExport: function( event, ui ) {
var Cols = grid.Columns();
Cols.alter(function(){
Cols.find(function(column){
return (column.hidden==true);
}).copy = false;
})
}
-
Yes it's not working right.
Please use hideCols event which is fired when columns are shown/hidden via dropdown menu.
hideCols: function(evt, ui){
var grid = this;
ui.diHide.forEach(function(di){
grid.getColumn({dataIndx: di}).copy = false;
})
ui.diShow.forEach(function(di){
grid.getColumn({dataIndx: di}).copy = true;
})
},
Note that the columns which are initially hidden should also be marked as copy: false.
-
Thanks works fine with 5.6.0.
Is there a solution for version 5.1.0 (old columnselector)...doesn't update the copy value (true, false)?
-
When loading a saved state the copy value for the columns doesnt seem to be updated correctly...
How can I update when the state is loaded?
Thanks in advance.
-
1) column.copy values can also be saved in state by adding copy: 1 in stateColKeys
https://paramquery.com/pro/api#option-stateColKeys
2) using beforeExport event to set copy: false to columns is also fixed in v5.6.1
-
Trying:
beforeExport: function(evt, ui ) {
ui.diHide.forEach(function(di){
grid.getColumn({dataIndx: di}).copy = false;
})
ui.diShow.forEach(function(di){
grid.getColumn({dataIndx: di}).copy = true;
})
},
But ui.diHide etc doesn't seem to be available...?
-
ui.diHide is available in hideCols event only.
beforeExport event ( alternative way to set copy: false ) is used to set copy:false on hidden columns just before exporting. Please refer previous messages in this post.
-
Trying:
beforeExport: function( event, ui ) {
var Cols = grid.Columns();
Cols.alter(function(){
Cols.find(function(column){
return (column.hidden==true);
}).copy = false;
})
}
But it only seems to be applied to first column.
-
That's understandable considering Cols.find returns a single column.
Please use each method.
Cols.each(function(column){
column.copy = !column.hidden;
})
https://paramquery.com/pro/api#method-Columns
PS: Please refer the docs first when in doubt.
-
I will, thanks for help.