Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] VueAdminTable: Change tableDataEndpoint + reload() ? #6695

Closed
wsydney76 opened this issue Aug 21, 2020 · 3 comments
Closed

[Question] VueAdminTable: Change tableDataEndpoint + reload() ? #6695

wsydney76 opened this issue Aug 21, 2020 · 3 comments
Assignees
Labels

Comments

@wsydney76
Copy link

Description

Trying to filter data in a VueAdminTable with data loaded via ajax/tableDataEndpoint, but could not figure out how to dynamically set a new tableDataEndpoint and refresh the data without reloading the whole page.

Something like table.settings.tableDataEndpoint = 'main/ads/data?status=open' + table.reload()

Is this even possible right now? (if not, this is a FR...)

/Aylin

@Mosnar
Copy link
Contributor

Mosnar commented Aug 22, 2020

@wsydney76 Last time I checked, there wasn't a public API to do this; however, I was able to "hack" it by modifying the prop on the table component, which triggers a reload. Here's an example where toggling the site switcher would reload the data in the table for that site:
https://github.com/venveo/craft-redirect/blob/master/src/assetbundles/admintablesiteswitcher/dist/js/AdminTableSiteSwitcher.js

It's messy and it'll probably break eventually, but it works in a pinch!

@wsydney76
Copy link
Author

@Mosnar Great, thanks, works perfectly right now.

Notes for myself:
table.$children[0].$props.tableDataEndpoint = endpoint;

Looks like you can't initialise the vue table as documented new Craft.VueAdminTable({...options...}); to get this working : has to be new Craft.VueAdminTable().init({...options...}); instead.

Also table.$children[0].reload(); for picking up latest updates from front end.

/Aylin

@wsydney76
Copy link
Author

Cleaning up, this is finally implemented via #13416.

/Karla

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants