Pagination and info outside of the DataTables sDom control (solved)
Pagination and info outside of the DataTables sDom control (solved)
I need to show pagination and info elements outside of the DataTables sDom control. How I can do that kind of thing? If this is possible, please provide to me an example code.
If that is not possible am I able to close datatables wrapper DIV element right after when I'm closing the datatables ... ?
Background for this case: I have added jquery treeview component to the left side of the datatable.Clicking the treeview lists documents in the datatables element. Now I need to move those info and pagination elements to my own DIV element. I cannot do the layout modification using sDom. Im using smoothness theme and full_numbers pagination. I hope someone could help me with this problem.
-josk
If that is not possible am I able to close datatables wrapper DIV element right after when I'm closing the datatables ... ?
Background for this case: I have added jquery treeview component to the left side of the datatable.Clicking the treeview lists documents in the datatables element. Now I need to move those info and pagination elements to my own DIV element. I cannot do the layout modification using sDom. Im using smoothness theme and full_numbers pagination. I hope someone could help me with this problem.
-josk
This discussion has been closed.
Replies
[code]
div.leftColumn {
float:left;
width:20%;
height:auto;
}
[/code]
You can use jQuery to move all your elements inside div.leftcolumn
Put your buttons anywhere you want to... and they could be any object... and do something like the following for 2 button control:
[code]
var oTable;
$(document).ready(function(){
oTable = $("#example").dataTable();
$("#paginate_left").click(function(){
oTable.fnPageChange( 'previous' );
});
$("#paginate_right").click(function(){
oTable.fnPageChange( 'next' );
});
});
[/code]
I hope this helps some.
[code]
$(document).ready(function() {
$('#example').dataTable( {
"sDom": '<"leftcolumn"><"rightcolumn"<"H"lfr>t><"bottombar"<"F"ip>>'
} );
$("div.leftcolumn").html('AND HERE I PRINTED IN ONE LONG ROW ABOUT 100 LINES OF TREEVIEW CODE.');
} );
[/code]
At least this way I was able to move columns like they should be. But I had to add 100 rows of html+javascript code to the one variable without any line breaks. And somehow it mess that treeview code so it doesnt work anymore.
TomC: My problem wasn't to get treeview leftside of the datatable. I needed to get that paging element under the treeview + datatable component. That wasn't anymore so simple task to do.
talkitivewizard: Thanks for the solution. I think I am not able to add those page numbers buttons this way, am I right? I had to test your method tomorrow morning.
I think there must be some kind of javascript code that I can put in the page and it prints these datatable elements? If someone know the way, let me know.
Or if someone know how I am able to add 100 lines custom code that is printed in the between these datatable elements.
-josk
EDIT: argh, its not working
[code]$('.new_place_for_pagination').append($('#toolbar_div'));[/code]
http://api.jquery.com/append/
[code]
jQuery("#numbers_numbers").ready(function(){
jQuery("#trigger_report_paginate").appendTo(jQuery("#numbers_numbers"));
});
[/code]
Where #numbers_numbers was another div elsewhere on the page and trigger_report was the ID of my table. Worked beautifully for me.