F_bio Gon_alves
Tera Expert

Hi SNC,

With the help of Gurpreet Singh and Darshak AdhikarlaI have recently managed to meet a couple of requirements I had:

1. Add a Keyword Search Box to the "Data Table From Instance Definition" widget.

2. When I make 2 sequential searches using the new Keyword Search Box what happens is that the different keywords keep being add to the filter conditions (e.g. I first look for "Test" and then I look for "Demand"; the resultant filter is updated to "All > Keywords = Test > Keywords = Demand") is there a way so that I can "clear" the previous keyword I have looked for previously whenever I look for a new keyword and that way end up with a filter that is simply "All > Keywords = Demand", i.e. always maintain only the last looked up keyword?

Solution:

1. Please follow these steps (a) to h)) to add the Keyword Search Box to the "Data Table From Instance Definition" widget.

a) First you will need to clone the OOTB "Data Table From Instance Definition" widget;

b) After you add your cloned "Data Table From Instance Definition" widget to your Portal Page, Ctrl + right click on widget and click Widget Options Schema;

c) Add a new option by clicking on the "+" icon;

d) Fill the form as shown bellow,

Capture.PNG

e) Click "Save";

f) Update cloned "Data Table From Instance Definition" widget Server Script:

Add this line in the var widgetParams,

show_keywords: options.show_keywords

g) Save the widget modifications.

h) Simply configure instance options and check Show Keyword Search Checkbox.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

2. Please follow these steps to update your Keyword Search Box to maintain only the last looked up keyword.

a) First you will need to clone the OOTB "Data Table" widget.

b) Update cloned "Data Table" widget HTML:

Replace line 19 of your cloned "Data Table" widget with this line (updated piece of code highlighted in bold),

<button name="search" class="btn btn-default" type="submit" ng-click="clearSearch()"><span class="glyphicon glyphicon-search"></span></button>

c) Update cloned "Data Table" widget Client Script:

Add the following function to your cloned "Data Table" widget,

$scope.clearSearch = function(){  

        $scope.data.filter = c.data.storef;

        $scope.setSearch(true);

};

d) Update cloned "Data Table From Instance Definition" widget Server Script:

Add this line in the var widgetParams,

storef: data.filter

P.S. To remove a looked up keyword simply click the magnifying glass (or press enter on your keyboard) with an empty search box.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

With this simple but effective updates, you will get a Keyword search box that only maintains on your filter conditions the last looked up keywords, instead of keeping add new keywords to your filter every time you enter a new keyword.

Hope this will help you guys 😉

Any doubt, I will be more than happy to help you.

Best regards,

Fábio Gonçalves

Comments
Ken24
Giga Expert

Hi Fábio, shouldn't the same concept of 'show_keywords: options.show_keywords,' work for 'show_breadcrumbs: options.show_bread_crumbs,'?   Assuming I have added the Widget Options Schema for it.

find_real_file.png

find_real_file.png

Thanks, Ken

 

F_bio Gon_alves
Tera Expert

Hi Ken,

 

I'm sorry for the late reply.
I would say it should, yes. Is it not?

 

Kind regards,

 

Fábio Gonçalves

Ken24
Giga Expert

Hi Fabio, no worries.   It does not seem to work even though the option setup and code looks correct.  It displays checked or unchecked and since our current usage is to Display, I didnt go further with it.

I also added the "filter", it does work as an option.  Go figure.  I will look more as time permits.

Thanks, Ken.

Christophe
Tera Contributor

Thank you for this post. This soluotion works perfect. One thing you might want to add to your provided steps.

Don't forget to change the following.

In the clone of the Data Table Instance Definition --> Server Script --> data.dataTableWidget = $sp.getWidget('widget-data-table', widgetParams) you need to change widget-data-table to the ID of the clone you made of the Data Table.

Version history
Last update:
‎08-24-2017 03:12 AM
Updated by: