Closed utilmind closed 4 weeks ago
Please provide an Online Example to show your problem. Thanks!
We will close this issue as we got no response form you. If you still need help with that please provide us an example as @wenzhixin said.
@UtechtDustin -- We will close, or already closing? In either case, it's can't be closed as "Completed". It's not completed.
@wenzhixin here you go https://live.bootstrap-table.com/code/utilmind/17717 There are 2 buttons in example. First specifying parameters in documented 'query' property (this example doesn't works), second specifying parameter(s) directly in the 'url' (this works).
@UtechtDustin please don't close the issue as “Completed” immediately after reminder. This is extremely discouraging.
Just in case, here is the source code of PHP script which generating content for my example on https://live.bootstrap-table.com/code/utilmind/17717
<?php
if (isset($_GET['required-parameter'])) {
$out = [
[
'id' => 1,
'name' => 'name1',
'price' => 123.45,
],
[
'id' => 2,
'name' => 'name2',
'price' => 543.21,
],
];
}else {
$out = [];
}
// No cache
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.date('r'));
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');
header('X-Robots-Tag: noindex, nofollow, noarchive');
// Allow at least live.bootstrap-table.com
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: *');
// Output JSON
header('Content-type: application/json');
exit(json_encode($out, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
As I mentioned in my top comment, I'm not contributing the fix for this issue because a workaround with ?parameters= in the url
works pretty well for me, although this is obviously wrong that query
is ignored in the refresh
method and could be issue for someone else.
Sorry, my bad. I don't know that the close button marks it as completed or that there is a close option without out the completed part.
The query
option of the refresh method is internally almost the same as the queryparams table option.
Which means you have to define the query as Object, as documented on both options.
Working demo: https://live.bootstrap-table.com/code/UtechtDustin/17720
@UtechtDustin Okay, yes, my bad I specified the query incorrectly in my example, but it was correct in my real app.
Here is another example: https://live.bootstrap-table.com/code/utilmind/17722 It uses your fix + little improvement, "refresh" button in toolbar.
query
will not be preserved, it will not be used for native refresh.You're right! if a url is passed to the refresh method the url will be set as new "base"-url, which means if we have a url with parameters the parameters are also the new default value. If we pass the query they are only used for the next request. https://github.com/wenzhixin/bootstrap-table/blob/develop/src/bootstrap-table.js#L3094-L3106
That should be an easy fix, as soon we get a query object we have to add/merge it to our base url.
Should be fixed by #7353. Working example with the fix: https://live.bootstrap-table.com/code/UtechtDustin/17731
Bootstraptable version(s) affected
1.22.5 (latest)
Description
Unfortunately "refresh" button on toolbar is useless, if I originally provide the request parameters as "query" property, instead of straightforward GET-query, as part of "url" property.
So if I originally provide data as follows, this will not work on manual "refresh" (click on refresh button on toolbar), it will just ignore "query" on repeating request:
However, the following will work:
I think it should not ignore data provided in "query" on repeating "refreshes". The workaround provided above is works for me, so I don't submitting the pool request, but would switch to "query" if it will be fixed in further Bootstrap Table versions.
Example(s)
No response
Possible Solutions
Fix initServer() method, reuse saved "query" parameter from previous "refresh" request.
Additional Context
No response