-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Bug]: Table filter issue while refresh the page there's no data fetched. #131
Comments
@CodeWithDennis |
I completely missed this reported issue. I’ll take a look when I have some time. If you think you might have a solution, feel free to submit a PR—I’m open to it! |
I can't replicate this issue. (see video) @DevYSM Schermopname.2025-03-16.om.15.32.57.mov |
There is an issue! @CodeWithDennis, I'm sure that if you open the filter dropdown from your video, you'll see that the selection is not present. The problem is in the types of selection keys (string or numbers). If you are using numeric IDs treejs state is an array of numbers, but from session or url query, they are strings. My solution is to convert all keys to strings: //in SelectTree.php
public function getCustomKey($record)
{
$key = is_null($this->customKey) ? $record->getKey() : $record->{$this->customKey};
return (string) $key;
} But this leads to another issue with already selected states in the form field (not in the filter). If they a numbers treejs looking for number in strings and can't find selected. The solution is to convert all numbers to strings in state in index.js: //in index. js
init() {
if (typeof this.state === 'number') {
this.state = this.state.toString();
}
if (Array.isArray(this.state)) {
this.state = this.state.map(item => item.toString());
}
this.tree = new Treeselect({
id: `tree-${name}-id`,
ariaLabel: `tree-${name}-label`,
parentHtmlContainer: this.$refs.tree,
value: this.state,
... This work for me, but I don't like it. If anyone has a better solution, please share. |
If this doesn't break existing functionality, I'm happy to accept the PR for now until we find a more solid solution. |
Should be fixed in latest release. |
Great, I'll test it InshaAllah |
What happened?
The expected behavior is that.
While filtering and getting the data that's good.
But while trying to refresh the page there's no data showing in the table.
How to reproduce the bug
I think you should get the selected values from the filters array in the URL and display these in the select tree.
Package Version
3.2.36
PHP Version
8.1
Laravel Version
10
Which operating systems does with happen with?
Linux
Notes
The result while searching.

the result while refresh the page with the same filter
The text was updated successfully, but these errors were encountered: