/// class PD.Web.UI.Controls.ViewGridUndoCommand
/// using PD.Web.UI.Controls.ViewGridCommand

PD.Web.UI.Controls.ViewGridUndoCommand =
PD.Web.UI.Controls.ViewGridCommand.extend({

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

    setDefaults: function () {
        this._super();
        this.props("id", "view-grid/undo");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("undo.png"));
        this.props("label", "Undo");
        this.props("tooltip", "Undo");
    },

    execute: function (e) {
        this._super(e);

        var that = this;

        PD.ajax({
            type: "POST",
            url: PD.Path.resolve("~/view/undo?") + $.param({
                viewStateId: this.get_viewStateId()
            }),
            success: function () {
                that.get_viewGrid().build();
            }
        });

    }

});