Escape from Default's Yii2 Delete Confirm Box

I found this code on the wiki


// --- Delete action (bootbox) ---

yii.confirm = function (message, ok, cancel) {

 

    bootbox.confirm(

        {

            message: message,

            buttons: {

                confirm: {

                    label: "OK"

                },

                cancel: {

                    label: "Cancel"

                }

            },

            callback: function (confirmed) {

                if (confirmed) {

                    !ok || ok();

                } else {

                    !cancel || cancel();

                }

            }

        }

    );

    // confirm will always return false on the first call

    // to cancel click handler

    return false;

}

but when I click ‘ok’, the page refreshes, but it should trigger pjax reload, how can I do this?

$.pjax.reload({container: ‘#grid-pjax’});