- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2017 04:25 PM
Hi All,
I am using the data table widget and am wondering if it is at all possible to have the filter reference a variable, i.e. user input. I am not quite familiar with widgets but I know that javascript can be run in the filter (only server side though). If it is not possible I would need to create it myself and any tips on how to approach that would be great too.
Thanks for any help.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2017 10:58 PM
Hi
The "Data Table" widget is actually not meant to be use directly - it is meant to be embedded in another widget (eg. Data Table form Instance definition and Data Table from URL Definition). This widget will pass the query and control data to the Data Table widget.
So you just make you own "front-end" widget which have the dynamic filter option you need and then pass the data to the embedded Data Table widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2018 01:36 PM
Still, now I have this problem, I cannot able to change the filter by dynamically, Business is based on the click event I need to show the different records, So I need to update the [data.filter] from the client side script, But everything is getting and setting correctly, I get the log message correctly but when I click the button it shows like "No records in", I want clarification on this problem. Anyone, please help me.
HTML Code:
<div class="tab">
<button name="Active" role="link" class="tablinks" ng-click="activeRecord()" aria-label="${Active records}">${Active}</button>
</div>
Client-side code:
var c = this;
$scope.activeRecord = function(){
c.data.j = "active=true";
c.data.show_breadcrumbs = true;
c.server.update();
});
Server side code:
data.filter = input.j;
data.table_label = gr.getLabel();
var widgetParams = {
table: data.table,
fields: data.field_list,
o: data.o,
d: data.d,
filter: data.filter,
window_size: data.window_size,
view: 'sp',
title: options.title,
show_breadcrumbs: false
};
data.dataTableWidget = $sp.getWidget('widget-data-table', widgetParams);
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-12-2019 09:18 AM
A bit late here, but I've been working on this for a couple of weeks and found this solution. I just added this line of code to my client controller and the record list refreshed automatically:
$scope.$broadcast('widget-filter-breadcrumbs.queryModified', myEncodedQuery);