mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-11-08 23:43:32 -05:00
fix(manage-tables): include search/sort params in export queries
Export query builders dropped active search/sort/order state, causing exported data to not match what user currently viewed in table. - Add current_query_params() helper to extract searchText, sortName, sortOrder from bootstrapTable options - Use it in export_all_query_string() so full export respects active filters/sort - Merge it into export_page_query_string() alongside existing limit/offset pagination params Signed-off-by: objecttothis <17935339+objecttothis@users.noreply.github.com>
This commit is contained in:
1 parent
91ccf444f9
commit
ca7f4cfc54
1 file changed
+13
-4
@@ -332,9 +332,18 @@
|
||||
});
|
||||
};
|
||||
|
||||
const current_query_params = function(tableOptions) {
|
||||
return {
|
||||
search: tableOptions.searchText,
|
||||
sort: tableOptions.sortName,
|
||||
order: tableOptions.sortOrder
|
||||
};
|
||||
};
|
||||
|
||||
const export_all_query_string = function() {
|
||||
const queryParamsFn = $('#table').bootstrapTable('getOptions').queryParams;
|
||||
const params = queryParamsFn ? queryParamsFn({}) : {};
|
||||
const tableOptions = $('#table').bootstrapTable('getOptions');
|
||||
const queryParamsFn = tableOptions.queryParams;
|
||||
const params = queryParamsFn ? queryParamsFn(current_query_params(tableOptions)) : {};
|
||||
delete params.limit;
|
||||
delete params.offset;
|
||||
|
||||
@@ -344,10 +353,10 @@
|
||||
const export_page_query_string = function() {
|
||||
const tableOptions = $('#table').bootstrapTable('getOptions');
|
||||
const queryParamsFn = tableOptions.queryParams;
|
||||
const params = queryParamsFn ? queryParamsFn({
|
||||
const params = queryParamsFn ? queryParamsFn($.extend(current_query_params(tableOptions), {
|
||||
limit: tableOptions.pageSize,
|
||||
offset: (tableOptions.pageNumber - 1) * tableOptions.pageSize
|
||||
}) : {};
|
||||
})) : {};
|
||||
|
||||
return $.param(params);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user