data table widget - dynamic filter

techies
Kilo Expert

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.

1 ACCEPTED SOLUTION

larstange
Mega Sage

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


View solution in original post

11 REPLIES 11

Rajeshkumar1
Kilo Expert

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);


})();

lss123
Tera Contributor

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);