checkForButtonVisiblity: function()

in dashboardv2/public/js/views/search/SearchLayoutView.js [183:220]


            checkForButtonVisiblity: function(e) {
                if (this.type == "basic" && e && e.currentTarget) {
                    var $el = $(e.currentTarget),
                        isTagEl = $el.data('id') == "tagLOV" ? true : false;
                    if (e.type == "change" && $el.select2('data')) {
                        var value = $el.val(),
                            key = (isTagEl ? 'tag' : 'type'),
                            filterType = (isTagEl ? 'tagFilters' : 'entityFilters'),
                            value = value.length ? value : null;
                        if (this.value) {
                            if (this.value[key] !== value || (!value && !this.value[key]) || (!this.value[filterType])) {
                                var temp = {};
                                temp[key] = value;
                                _.extend(this.value, temp);
                                this.query[this.type][filterType] = null;
                                this.value[filterType] = null;
                                this.makeFilterButtonActive(filterType);
                            }
                        } else {
                            this.ui.tagAttrFilter.prop('disabled', true);
                            this.ui.typeAttrFilter.prop('disabled', true);
                        }
                    }
                }
                var that = this,
                    value = this.ui.searchInput.val() || this.ui.typeLov.val();
                if (!this.dsl && !value) {
                    value = this.ui.tagLov.val();
                }
                if (value && value.length) {
                    this.ui.searchBtn.removeAttr("disabled");
                    setTimeout(function() {
                        that.ui.searchInput.focus();
                    }, 0);
                } else {
                    this.ui.searchBtn.attr("disabled", "true");
                }
            },