All is in the view :
{{extend 'layout.html'}}
{{=table}}
all needed dependency
$(document).ready(function() {
$("#tabs").tabs( {
"show": function(event, ui) {
var oTable = $('div.dataTables_scrollBody>table.sortable',
ui.panel).dataTable();
if ( oTable.length > 0 ) {
new FixedColumns( oTable, {
"iLeftColumns": 1,
} );
}
}
} );
var sSwfPath_location =
"{{=URL('static','plugin_added/DataTables-1.8.1/extras/TableTools/media/swf/copy_cvs_xls_pdf.swf')}}"
$('table.sortable').dataTable( {
"bJQueryUI": true,
"bAutoWidth": false,
"bScrollInfinite": true,
"sScrollY": "300px",
"sScrollX": "100%",
"bPaginate": false,
"bProcessing": true,
"bSortClasses" : false,
"sDom": '<"H"Tfr>t<"F"ip>',
"oTableTools": {
"aButtons": [
"copy",
"csv",
"xls",
{
"sExtends": "pdf",
"sPdfOrientation": "landscape",
"sPdfMessage": "Your custom message would go here."
}
],
//"sRowSelect": "multi", // It copy all rows anyway?? + Glitch if
fixedcolumn
"sSwfPath": sSwfPath_location
},
"oLanguage": {
"sSearch": "Search:"
},
"aoColumnDefs": [
{ "sWidth": "10%", "aTargets": [ -1 ] }
]
} );
} );
</script>
I think the HMTL is already loaded... I think as I said that it coming from
the Datatable parsing and the {} that have a meanig in javascript...
I let you understand what for it works that way and not the other ;-)
Richard
On Thu, Aug 4, 2011 at 6:24 PM, Anthony <[email protected]> wrote:
> Can you show more of your code? I don't see why your second version should
> work if the first one didn't. Was the original code inside a web2py view (so
> the URL would get rendered before the HTML was sent to the browser)?
>
> Anthony
>
> On Thursday, August 4, 2011 5:58:49 PM UTC-4, Richard wrote:
>
>> No, I think it a Datatables parsing issue since Datatables TableTools
>> is waiting for a URL... I don't know why...
>>
>> Richard
>>
>> On 4 août, 17:56, Anthony <[email protected]> wrote:
>> > On Thursday, August 4, 2011 5:36:13 PM UTC-4, Richard wrote:
>> >
>> > > Hello,
>> >
>> > > I try to do this :
>> >
>> > > $(document).ready(function() {
>> > > $('table.sortable').dataTable( {
>> > > "sDom": '<"H"Tfr>t<"F"ip>',
>> > > "oTableTools": {
>> > > "sSwfPath": "{{=URL('static','plugin_**added/DataTables-1.8.1/extras/
>>
>> > > TableTools/media/swf/copy_cvs_**xls_pdf.swf')}}"
>> >
>> > Is the line break after "extras/" in your original code? If so, that
>> should
>> > be causing a syntax error in the web2py view rendering. If you remove
>> that
>> > line break, web2py should fill in the URL properly. If it still doesn't
>> > work, it probably has something to do with not setting up DataTables
>> > properly.
>> >
>> > Anthony
>>
>