Bug 30406: Add column filters before hiding columns
The code that adds column filters works only on visible columns, so we should hide columns after filters are created Test plan: 1. Apply patch 2. Go to Tables settings. Hide city_state for the cities table. 3. Create some cities and go to the cities page 4. Verify that filtering works as expected. 5. Make the city_state column appear. Verify that filtering on this column works too Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
4caac3189e
commit
37594d7737
|
|
@ -791,14 +791,6 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
|
|||
|
||||
var table = $(this).dataTable(settings);
|
||||
|
||||
table.DataTable().on("column-visibility.dt", function(){
|
||||
if( typeof columnsInit == 'function' ){
|
||||
// This function can be created separately and used to trigger
|
||||
// an event after the DataTable has loaded AND column visibility
|
||||
// has been updated according to the table's configuration
|
||||
columnsInit();
|
||||
}
|
||||
}).columns( hidden_ids ).visible( false );
|
||||
|
||||
if ( add_filters ) {
|
||||
var table_dt = table.DataTable();
|
||||
|
|
@ -828,6 +820,15 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) {
|
|||
} );
|
||||
}
|
||||
|
||||
table.DataTable().on("column-visibility.dt", function(){
|
||||
if( typeof columnsInit == 'function' ){
|
||||
// This function can be created separately and used to trigger
|
||||
// an event after the DataTable has loaded AND column visibility
|
||||
// has been updated according to the table's configuration
|
||||
columnsInit();
|
||||
}
|
||||
}).columns( hidden_ids ).visible( false );
|
||||
|
||||
return table;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue