1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- 'use strict';
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015, 2017
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- /**
- * This is a toolbar view for searching in datawidgets
- */
- define(['../../lib/@waca/dashboard-common/dist/ui/SearchableListView', 'text!./DataWidgetSearch.html', 'app/nls/StringResources', 'jquery', 'underscore'], function (BaseView, Template, resources, $, _) {
- var View = null;
- View = BaseView.extend({
- templateString: Template,
- init: function init(options) {
- View.inherited('init', this, arguments);
- this.visualizations = {};
- _.extend(this, options || {});
- this.widget = this.content.getFeature('WidgetAPI.deprecated').getVisApi().ownerWidget;
- this.visualization = this.content.getFeature('Visualization');
- this.currentVis = this.visualization.getDefinition().getId();
- this.$el.addClass('searchPopoverContent');
- },
- onFlyoutDestroyed: function onFlyoutDestroyed() {
- this.searchData('');
- },
- getRenderedHtml: function getRenderedHtml() {
- var $content = $('<div class="toolbarPopoverContent"></div>');
- $content.append(this.$el);
- return $content;
- },
- getCustomRenderProperties: function getCustomRenderProperties() {
- return { searchText: resources.get('search') };
- },
- notifyRenderComplete: function notifyRenderComplete() {
- var $input = this.$el.find('input');
- $input.focus();
- },
- searchData: function searchData(searchTerm) {
- var slots = this.visualization.getSlots();
- var mappings = slots.getMappingInfoList();
- var columnId = mappings[0].dataItem.getColumnId();
- var filterKey = this.widget.visModelManager.searchFilters.getCategoryFilterKey(columnId);
- // trim leading and trailing space in the search term to match content-navigation search behavior
- // eg. searching ' pro ' finds 'product'
- searchTerm = searchTerm.trim();
- if (searchTerm.length > 0) {
- this.widget.visModelManager.searchFilters.updateFilterEntry(filterKey, { values: searchTerm, operator: 'containsignorecase' });
- } else {
- this.widget.visModelManager.searchFilters.removeFilterEntry(filterKey);
- }
- this.widget.visModelManager.searchFilters.allFilterModificationComplete({ payloadData: { skipUndoRedo: true } });
- }
- });
- return View;
- });
- //# sourceMappingURL=DataWidgetSearchView.js.map
|