Add and refine Keyword Search Box to "Data Table from Instance Definition" widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2017 04:39 AM
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,
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 01:55 AM
This is great, from our requirement we have predefined filters for example, state is submitted, state is cancelled.
When clearing the search, it resets those filters to, is there any way to just remove the keyword search?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2017 02:06 AM
Hi brendanwilson84,
Actually I initially thought that behavior that you required was in fact the one being followed.
However, later I realized it was not. It actually reset all the previous filters when you remove the keywords, like you described.
Unfortunately, I didn't had the time to look into it in more detail.
When I manage to get back to this issue and will let you know if I find a solution.
Best regards,
Fábio Gonçalves
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2017 10:28 AM
This is a wonderful guide - I have had to fulfill both of these requirements recently. Is there a way to limit the keyword search to only certain fields on the table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-06-2017 01:44 AM
Hi Taylor Manfredi,
I have been struggling with that that same question for some time and never got to a conclusive answer. I believe it would be possible, with some additional configurations.
Unfortunately, I didn't had the time to look into it in more detail.
When I manage to get back to this issue and will let you know if I find a solution.
Best regards,
Fábio Gonçalves