GigaTables / reactables

GigaTables is a ReactJS plug-in to help web-developers process table-data in applications and CMS, CRM, ERP or similar systems.
MIT License
144 stars 30 forks source link

reload button doesn't support url parameter and triggerAfter/triggerBefore function #110

Closed wangfrombupt closed 6 years ago

wangfrombupt commented 6 years ago

This is related to #103. We want to use reload button just like other buttons( i.e. create, delete and edit). But it seems that the following setting doesn't work.

let editor = {
    ajax: {
        reload: {
            url: '/update_radar',
            type: 'GET',
        },
    },
    tableOpts: {
        buttons: [
            {
                extended: "editor_reload", editor: editor, triggerAfter: (function () {
                    alert("refresh compelted!")
                }), triggerBefore: (function () {
                    alert("It would take about thirty seconds, please waiting...")
                    userService.updateRadar()
                })
            }
        ],
arthurkushman commented 6 years ago

While it is logically correct to expect triggerAfter/triggerBefore and I will definitely add them to consist with other buttons why do you need specific url for reload button, it's more natural to use already defined GET url from ajax string or object from settings, could u explain that pls?

PS it seems to me that reload button with other url and most probably content is about inconsistent working system with an unreliable data.

wangfrombupt commented 6 years ago

Actually, the other URL specified in reload button points to a different endpoint which fulfills extra work at the backend before returning the rows of the database table. But I think maybe triggerAfter/triggerBefore would suffice our need since I can fetch that URL from triggerBefore, get the table content back using the default URL, and informs the user of the completion of the refresh in triggerAfter. So, please add triggerAfter/triggerBefore to reload button for the moment. Thanks a lot.

arthurkushman commented 6 years ago

https://github.com/GigaTables/reactables/releases/tag/2.4.6