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.
Related
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.
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();
}
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
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.
I am using this plugin called X-Editable.
A little stuck on how to accomplish this so I figured I would see if anyone else has used it or knows what to do.
Here is what my Page looks like:
screenshot http://imageshack.us/a/img850/4817/yko7.png
You can simply click on the text and it will allow you to edit it right there and there.
Now, as my end result, all I am trying to do is get the values from each of the rows but cant seem to figure it out.
Per the doc, I set my code up like the section here: "Creating new record". I just dont know how to get the values or the object when I click on my button.
Anyone had any experience with this?
Here you go.
http://jsfiddle.net/8vTPL/1/
This should at least get you going in the right direction. This example uses basic jQuery concepts to loop through collections. In your case, you want to loop through all of your table rows (line 7):
$('#tbl_values tbody tr').each(function(ix,obj...
get the id of each row/record (line 8):
$(obj).attr('id')
then loop through each table-data and x-editable element per that row (line 9):
$(obj).children('td').children('.editable').each(function(e_ix,e_obj...
get the id of each column/field (line 10):
$(e_obj).attr('id')
and get the value of each x-editable element in the row (line 11):
$(e_obj).editable('getValue')[$(e_obj).attr('id')]
Alternatively, you could just get the object that X-editable stores as the value:
$(e_obj).editable('getValue')
Hope this helps.