[BUG] Datatables and adding data
[BUG] Datatables and adding data
techguy1988
Posts: 27Questions: 0Answers: 0
For some reason when using the following code to add a new row, datatables creates a new "search bar", "Number of records" and "Showing Entries".
This means that you have all of the controls on the page twice! Whats going on here!?
http://oi54.tinypic.com/2hcere9.jpg
This means that you have all of the controls on the page twice! Whats going on here!?
http://oi54.tinypic.com/2hcere9.jpg
This discussion has been closed.
Replies
Allan
Thanks for getting back to me.
I am indeed intialising datatables twice (I have two tables on separate tabs).
But I am using the fnAddData function, maybe it's important to note that it's from an iFrame? So I'm using parent.window.
I am however using the same version of datatables for both of the tables, unless I am missing the point?!
Thanks.
If that doesn't help, can you post some code to show how you are doing what you are doing?
Thanks,
Allan
I've got version 1.7.3 (Latest), but I am still having the same issue :|
Code ...
[code]
$(document).ready(function() {
$('#data_table', window.parent.document).dataTable().fnAddData( [
'test test',
'test@test.com',
'test test',
'test test',
'test',
'test'] );
});
[/code]
[code]
$(document).ready(function() {
$('#example').dataTable().fnAddData( [
1,2,3,4,5
] );
} );
[/code]
Can you give us a link showing your setup which is causing the issue?
Thanks,
Allan
[code]
$(document).ready(function() {
$('#data_table').dataTable().fnAddData( [
'XXXXXX',
'test@test.com',
'test test',
'test test',
'test',
'test'] );
});
[/code]
Works fine - the parent.window is causing the issue!?
Problem is I have a lightbox opening and then the form submits to a iFrame from that, so I need someway of getting the parent element!
Allan
I've got to admit I am a bit out of my depth here - I am not the best at JQuery.
I've got a Lightbox which is opening this form and then the form posts to the iFrame. Do you know of another way to get the parent element through JQuery? (I am using JQuery tools for the Lightbox)
Thanks
Try this:
[code]
window.parent.$('#data_table').dataTable().fnAddData( [ .... ] );
[/code]
That should call jQuery in the parent document, and add the data using the already initialised table instance.
Allan
Regards,
Allan