GigaTables/reactables

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

wangfrombupt opened this issue · 3 comments

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()
                })
            }
        ],

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.

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.