/// class PD.Web.UI.Controls.RefreshGridWidget
/// using PD.Web.UI.Controls.GridWidget

PD.Web.UI.Controls.RefreshGridWidget =
    PD.Web.UI.Controls.GridWidget.extend({

        //===================================
        // PUBLIC METHODS
        //===================================

        template: function () {
            return `<div class='-pd-widget' style='font-size:16px;line-height:32px;text-align:center;cursor:pointer;'>
                        <i class="icofont-refresh" style="cursor:pointer;" title="Refresh"></i>
                    </div>`;
        },

        onActivate: function () {

            let id = this.get_grid().get_id();
            let $ico = this.get_grid().get_kendo().element.find(".-pd-widget > .icofont-refresh");

            $ico.on("click", (e) => {
                PD.context.getContextById(id)
                    .get_commands()
                    .execute("pd/view-grid:view-grid/refresh");
            });

        }

    });