Fixed DataTables earch / don't search the first column with buttons/menus (fixes #440)

This commit is contained in:
Bernd Bestel 2020-01-03 14:18:56 +01:00
parent 6345e69922
commit e515f21d3b
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
25 changed files with 45 additions and 19 deletions

View File

@ -28,6 +28,7 @@
- New endpoints for the stock transfer & stock entry edit capabilities mentioned above - New endpoints for the stock transfer & stock entry edit capabilities mentioned above
### General & other improvements/fixes ### General & other improvements/fixes
- Fixed that also the first column (where in most tables only buttons/menus are displayed) in tables was searched when using the general search field
- Fixed that the meal plan menu entry (sidebar) was not visible when the calendar was disabled (`FEATURE_FLAG_CALENDAR`) (thanks @lwis) - Fixed that the meal plan menu entry (sidebar) was not visible when the calendar was disabled (`FEATURE_FLAG_CALENDAR`) (thanks @lwis)
- Slightly optimized table loading & search performance (thanks @lwis) - Slightly optimized table loading & search performance (thanks @lwis)
- For integration: If a `GET` parameter `closeAfterCreation` is passed to the product edit page, the window will be closed on save (due to Browser restrictions, this only works when the window was opened from JavaScript) (thanks @Forceu) - For integration: If a `GET` parameter `closeAfterCreation` is passed to the product edit page, the window will be closed on save (due to Browser restrictions, this only works when the window was opened from JavaScript) (thanks @Forceu)

View File

@ -1,7 +1,8 @@
var batteriesTable = $('#batteries-table').DataTable({ var batteriesTable = $('#batteries-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
], ],
}); });
$('#batteries-table tbody').removeClass("d-none"); $('#batteries-table tbody').removeClass("d-none");

View File

@ -2,7 +2,8 @@
'paginate': true, 'paginate': true,
'order': [[1, 'desc']], 'order': [[1, 'desc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#batteries-journal-table tbody').removeClass("d-none"); $('#batteries-journal-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var batteriesOverviewTable = $('#batteries-overview-table').DataTable({ var batteriesOverviewTable = $('#batteries-overview-table').DataTable({
'order': [[2, 'desc']], 'order': [[2, 'desc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#batteries-overview-table tbody').removeClass("d-none"); $('#batteries-overview-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var choresTable = $('#chores-table').DataTable({ var choresTable = $('#chores-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#chores-table tbody').removeClass("d-none"); $('#chores-table tbody').removeClass("d-none");

View File

@ -2,7 +2,8 @@
'paginate': true, 'paginate': true,
'order': [[1, 'desc']], 'order': [[1, 'desc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#chores-journal-table tbody').removeClass("d-none"); $('#chores-journal-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var choresOverviewTable = $('#chores-overview-table').DataTable({ var choresOverviewTable = $('#chores-overview-table').DataTable({
'order': [[2, 'desc']], 'order': [[2, 'desc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#chores-overview-table tbody').removeClass("d-none"); $('#chores-overview-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var locationsTable = $('#locations-table').DataTable({ var locationsTable = $('#locations-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#locations-table tbody').removeClass("d-none"); $('#locations-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var apiKeysTable = $('#apikeys-table').DataTable({ var apiKeysTable = $('#apikeys-table').DataTable({
'order': [[4, 'desc']], 'order': [[4, 'desc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#apikeys-table tbody').removeClass("d-none"); $('#apikeys-table tbody').removeClass("d-none");

View File

@ -354,6 +354,7 @@ var quConversionsTable = $('#qu-conversions-table').DataTable({
"orderFixed": [[3, 'asc']], "orderFixed": [[3, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 }, { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 },
{ 'visible': false, 'targets': 3 } { 'visible': false, 'targets': 3 }
], ],
'rowGroup': { 'rowGroup': {

View File

@ -1,7 +1,8 @@
var groupsTable = $('#productgroups-table').DataTable({ var groupsTable = $('#productgroups-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#productgroups-table tbody').removeClass("d-none"); $('#productgroups-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var productsTable = $('#products-table').DataTable({ var productsTable = $('#products-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#products-table tbody').removeClass("d-none"); $('#products-table tbody').removeClass("d-none");

View File

@ -116,7 +116,8 @@ $('#quantityunit-form input').keydown(function(event)
var quConversionsTable = $('#qu-conversions-table').DataTable({ var quConversionsTable = $('#qu-conversions-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#qu-conversions-table tbody').removeClass("d-none"); $('#qu-conversions-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var quantityUnitsTable = $('#quantityunits-table').DataTable({ var quantityUnitsTable = $('#quantityunits-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#quantityunits-table tbody').removeClass("d-none"); $('#quantityunits-table tbody').removeClass("d-none");

View File

@ -66,6 +66,7 @@ var recipesPosTables = $('#recipes-pos-table').DataTable({
"orderFixed": [[4, 'asc']], "orderFixed": [[4, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 }, { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 },
{ 'visible': false, 'targets': 4 } { 'visible': false, 'targets': 4 }
], ],
'rowGroup': { 'rowGroup': {
@ -78,7 +79,8 @@ recipesPosTables.columns.adjust().draw();
var recipesIncludesTables = $('#recipes-includes-table').DataTable({ var recipesIncludesTables = $('#recipes-includes-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#recipes-includes-table tbody').removeClass("d-none"); $('#recipes-includes-table tbody').removeClass("d-none");

View File

@ -3,6 +3,7 @@
"orderFixed": [[3, 'asc']], "orderFixed": [[3, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 }, { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 },
{ 'visible': false, 'targets': 3 } { 'visible': false, 'targets': 3 }
], ],
'rowGroup': { 'rowGroup': {

View File

@ -2,6 +2,7 @@
'order': [[2, 'asc']], 'order': [[2, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 }, { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
], ],
}); });
$('#stock-detail-table tbody').removeClass("d-none"); $('#stock-detail-table tbody').removeClass("d-none");

View File

@ -2,7 +2,8 @@
'paginate': true, 'paginate': true,
'order': [[3, 'desc']], 'order': [[3, 'desc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#stock-journal-table tbody').removeClass("d-none"); $('#stock-journal-table tbody').removeClass("d-none");

View File

@ -2,6 +2,7 @@
'order': [[3, 'asc']], 'order': [[3, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 }, { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 },
{ 'visible': false, 'targets': 4 }, { 'visible': false, 'targets': 4 },
{ 'visible': false, 'targets': 5 }, { 'visible': false, 'targets': 5 },
{ 'visible': false, 'targets': 6 } { 'visible': false, 'targets': 6 }

View File

@ -1,7 +1,8 @@
var categoriesTable = $('#taskcategories-table').DataTable({ var categoriesTable = $('#taskcategories-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#taskcategories-table tbody').removeClass("d-none"); $('#taskcategories-table tbody').removeClass("d-none");

View File

@ -2,6 +2,7 @@
'order': [[2, 'desc']], 'order': [[2, 'desc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 }, { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 },
{ 'visible': false, 'targets': 3 } { 'visible': false, 'targets': 3 }
], ],
'rowGroup': { 'rowGroup': {

View File

@ -1,7 +1,8 @@
var userentitiesTable = $('#userentities-table').DataTable({ var userentitiesTable = $('#userentities-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#userentities-table tbody').removeClass("d-none"); $('#userentities-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var userfieldsTable = $('#userfields-table').DataTable({ var userfieldsTable = $('#userfields-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#userfields-table tbody').removeClass("d-none"); $('#userfields-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var userobjectsTable = $('#userobjects-table').DataTable({ var userobjectsTable = $('#userobjects-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#userobjects-table tbody').removeClass("d-none"); $('#userobjects-table tbody').removeClass("d-none");

View File

@ -1,7 +1,8 @@
var usersTable = $('#users-table').DataTable({ var usersTable = $('#users-table').DataTable({
'order': [[1, 'asc']], 'order': [[1, 'asc']],
'columnDefs': [ 'columnDefs': [
{ 'orderable': false, 'targets': 0 } { 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
] ]
}); });
$('#users-table tbody').removeClass("d-none"); $('#users-table tbody').removeClass("d-none");