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

Hi thanks for the reply,


I am unsure as to how exactly use that function. How exactly do I get that response?


Thanks for your help.


I have tried the above solution. Which format answer has to create.


larstange
Mega Sage

Hi - when I update the widget via the client script, i call the server to get data i need for the data model and then I refresh the widget via the spUtil.get.



Maybe you don't need this, you can generate it client side. If you need to call the server you can learn about it here.



Communicating between the Client Script and the Server Script of a widget - ServicePortal.io - Servi...


Hi,


Thanks for the reply that did the trick. I have one more question if you have the time. When the user chooses a value from the sn-record-picker the data table loads correctly with the right filter. However when the user selects another value from the record the data table does not refresh correctly. It just displays "No records in". All the new values are correctly passed to the server I feel as though the problem is just that the widget has troubles refreshing itself. Do you have any suggestions?


Thanks in advance for any help.



I have tried the below suggesed code from client side it is not working



spUtil.get("widget-data-table", answer).then(function(response) {


  c.data.dataTableWidget = response;


});


ManideepN
Tera Contributor

Hi,

 

I am also working on the same req. I am passing the filter condition dynamically from "Data table form" widget to "Data table" widget but the filter condition is not passing to "Data Table" widget, It passing a null value. In that widget I see that it's a encoded filter. 

Can you help me out how to pass the filter condition dynamically to "Data table" widget. 

Thanks in advance.

 

Regards,

Manideep Nadimpelli.