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

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

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

    setDefaults: function () {
        this._super();
        this.props("id", "column/remove-filter");
        this.props("enabled", true);
        this.props("label", "Remove Filter");
        this.props("tooltip", "Remove Filter");
    },

    setState: function (state) {
        this._super(state);
        this.props("visible", this._isFiltered());
    },

    execute: function (e) {
        this._super(e);
        
        var that = this,
            service = new PD.Web.UI.Controls.ViewGridService();

        service.removeFilter(that.get_viewStateId(), this.get_columnId(), function () {
            that.get_viewGrid().refresh();
        });

    },

    //===================================
    // PRIVATE METHODS
    //===================================

    _isFiltered: function () {
        return this.get_viewGrid().getActiveFilters().contains(this.get_columnId());
    }

});