Reset Webix datatable filter - javascript

I have a quite confusing question. I have a Webix datatable and trying to reset a filter (richSelectFilter) for a column. But it's acting not as I've expected. I tried
$$("table1").getFilter("title").config.value = "";
But nothing happens. Another attempt:
$$("table1").getFilter("title").config.value = "";
$$("table1").refreshColumns();
And filter was disappeared while values are still filtered!
Here's a short code snippet: http://webix.com/snippet/b34607aa
Am I doing something wrong? Will appreciate any help.

Try to use
$$("table1").getFilter("title").setValue("");
Here's a snippet http://webix.com/snippet/3eb45109
While you code will be correct for normal richselect control, filters in a datatable store the actual values in the column's config object. So you need to change it there, or just use the setValue API which will change value and will refresh the grid in the necessary way.

Related

get all rows of a pagination table

I'm using datatable in bootstrap4 and I've a pagination table (10 itens per pag).
I made a function to get values in table, but
when I tring to get all rows values, I've one problem because I only get the values show in a screen.
I tryed used in js ,
document.getElementById("myTable).tBodies[0].rows;
and tried Jquery
but always I get only the values in screen.
Has anyone had such a problem?
I used
$('#table').DataTable().data().row() ;
and it works but when I iterate this bring me a values like a "innerHTML" but I have functions in a rows(), so I need get values like a "innerText" because this is a values show in screen.
Thanks guys, I appreciate your help.

How to reintialize DataTable with dynamic column numbers?

I want to reinitialize the DataTable according to dropdown value changes on the page. if new table column number is equals to former column numbers then everthing is fine. But when the column number is less or more, then it gives me an error.
destroy function doesn't work in this scenario.
If I reload the page with new paramters it is also fine. But i want to solve this problem with ajax call.
Here is an example:https://jsfiddle.net/aaktas/arbcgvhz/24/<script async src="//jsfiddle.net/aaktas/arbcgvhz/27/embed/"></script>
I couldn't find a way inside the DataTable functions. I found a quick solution which is re-creating the html table element like below:
function reCreateTable() {
$('#reportsTable').remove();
$('.table-responsive').prepend('<table id="reportsTable" class="table table-striped" style="width:100%"></table>');
}
If someone can advice any other solution, it would be great.

How to add empty data row in Datatable using angular2+?

I want to add empty data row. My requirement is like columns are dynamic. I have tried using dtInstance to add the row. it's throwing some error.
here is the link
https://stackblitz.com/edit/how-to-replace-all-the-columns-dynamically-in-data-table-gvfose?file=app/app.component.ts
Please let me know if more details required.
I dont think that's possible with Angular-datatables out of the box, but you can use Angular-xeditable to achieve that as in this question. A better way to do it in my humble opinion would be, when the user clicks the 'add' button, we show a pop-up, they fill the data, we update the back-end or the reference table and rerender the table.
You gave the Data table wrong model. you are mixing between different models in your code.
I've fixed it as well adding two empty rows, make sure to align with the model defined by columnsDataObj
https://stackblitz.com/edit/how-to-replace-all-the-columns-dynamically-in-data-table-zemuq2?file=app/app.component.ts
There is a simple demo for your requirement that puts the other button to save the empty column you want to access the data.
For easy to use, add DATA button that would be shown the blank row with input, the style you desire to set up the CSS and don't forgot the CSS scope for your by Encapsulation.
DEMO
If the operation field is superfluous, rid it off and place the event for three columns after entering with your logical condition.
Annoying Button
The add DATA could be replaced with the below code, setup the life hook instead for insert the method in the constructor.
ngAfterViewInit (){
this.addData();
}

How to dynamically add the values in kendo Grid in editing state

In grid, I need to dynamically add a value to a column with a new row using a pop-up box. when I get dataSource I tried this method,
var firstItem = $('#GridName').data().kendoGrid.dataSource.data()[0];
firstItem.set('FirstName','The updated Name');
but it was useless. What should I do to achieve it? Thank you very much.
I look forward to your answer.
Please refresh your grid after changed value in data source.
Example : $('#Results').data('kendoGrid').refresh()

Servoy - Getting all data from db table to display as list

I am relatively new to Servoy and Javascript so that might be why i can't get this to work but here goes:
I am trying to get a label to display all of the data from a specific column from my database table in a list.
I tried to add a dataProvider but that adds only one record per page.
I need the items to be listed below each other so it makes it easier for me to see.
I have also tried adding:
function firstName(){
foundset.loadAllRecords();
return;
}
and setting it as an onRender to see if that displays everything
Thanks in advance
If you look for the answer then here it is:
Use a label and set the text of the label to
%%list_display%%
Set your form layout to Tableview
The answer for above was using Servoy Developer and PostgresSQl

Categories