/// class PD.Manage.Modules.DataModel.ExtensionColumnSearchGroupsFeature
// using ProspectDirector.Web.UI.FeatureSets.MacroEditorBase

PD.Manage.Modules.DataModel.ExtensionColumnSearchGroupsFeature =
    ProspectDirector.Web.UI.FeatureSets.MacroEditorBase.extend({

        //==============================
        // FIELDS
        //==============================

        _grid: null,

        //==============================
        // PROPERTIES
        //==============================

        get_node: function () {
            return $("#" + this.getId());
        },

        get_gridContainer: function () {
            return this.get_node().find("[data-id=grid-container]");
        },

        //==============================
        // INITIALIZERS
        //==============================

        _init_grid: function () {

            this._grid = new PD.Web.UI.Controls.Grid({
                container: "#" + this.getId() + " DIV[data-id=grid-container]",
                showToolbar: false,
                height: "100%",
                footer: {
                    visible: false
                },
                dataSource: {
                    data: this.getValue("usage")
                },
                messaging: {
                    noRecordsMessage: "Column not referenced by any search groups."
                },
                selectionMode: "none",
                resizable: true,
                columns: [
                    new PD.Web.UI.Controls.GridIconColumn({
                        field: "id",
                        width: "25px",
                        icon: "FORM_BLUE.png"
                    }),
                    new PD.Web.UI.Controls.GridColumn({
                        field: "type",
                        title: "Type",
                        width: "150px"
                    }),
                    new PD.Web.UI.Controls.GridColumn({
                        field: "name",
                        title: "Name",
                        width: "300px"
                    }),
                    new PD.Web.UI.Controls.GridFillColumn()
                ]
            });

        },

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

        activate: function () {
            this._init_grid();
        },

        render: function () {

            return [
                "<div id=\"" + this.getId() + "\">",
                "<div data-id='grid-container' style='position:absolute;top:10px;left:10px;right:10px;bottom:10px;overflow:hidden;border:1px solid #CCCCCC;'></div>",
                "</div>"
            ].join("");

        },

    });
