/// class PD.Web.UI.Controls.ViewGridColumnRemoveAllSortCommand
/// using PD.Web.UI.Controls.ViewGridColumnCommand

PD.Web.UI.Controls.ViewGridColumnRemoveAllSortCommand =
PD.Web.UI.Controls.ViewGridColumnCommand.extend({

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

    setDefaults: function () {
        this._super();
        this.props("id", "column/remove-all-sort");
        this.props("enabled", true);
        //this.props("icon", PD.Path.to16x16("columns.png"));
        this.props("label", "Remove All Sort");
        this.props("tooltip", "Remove All Sort");
    },

    setState: function (state) {
        this._super(state);
        this.props("enabled", this._isEnabled());
    },

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

        var dataSource = this.get_viewGrid().get_kendo().dataSource;

        dataSource.sort([])
        dataSource.read();

    },

    //===================================
    // PROTECTED METHODS
    //===================================

    _isEnabled: function () {
        return this._super()
            && this.get_viewGrid().get_dataSource().get_instance().sort().length > 0
    }

});