datatables didn't work with wordpress(

datatables didn't work with wordpress(

artem4ik19artem4ik19 Posts: 10Questions: 2Answers: 0
edited October 2014 in Free community support

On this link http://nit24.com/demo/demo_ext.html all works perfectly. But when i tried to move this code to wordpress page it doesn't work http://nit24.com/?page_id=284
I add to functions.php
wp_deregister_script('jquery');
wp_register_script( 'jquery','/scripts/jquery-2.1.1.min.js',null,null,null);
wp_enqueue_script( 'jquery' );
wp_register_script( 'your-script4','/demo/js/jquery.dataTables.min.js',null,null,null);
wp_enqueue_script( 'your-script4' );
wp_register_script( 'your-script5','/demo/js/jquery.dataTables.columnFilterExt.js',null,null,null);
wp_enqueue_script( 'your-script5' );

and page code:

[js]
jQuery(document).ready(function($) {
$('#table-example').dataTable( {
aoColumnDefs: [
{ bSortable: false, aTargets: [1] }
],
sPaginationType: "full_numbers",
oLanguage: {
sUrl: "../demo/datatables_lang_rus.txt"
},
aaSorting: [[0, "asc" ]],
bServerSide: true,
fnServerParams: function (aData) {
aData.push({name:'action', value:'data'});
},
sAjaxSource: "../demo/ajax_table_arts.php",
bProcessing: false
} ).columnFilter({
aoColumns: [
{ type: "text" },
{ type: "text" },
{ type: "text"},
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text"},
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
{ type: "text" },
],
sRangeFormat: "От {from} до {to}",
sTooltipClearSelect: 'Очистить фильтр',
sTooltipFactor: '<span title="зависимость от предыдущего фильтр-списка (списков)">⇐</span>',
sSelectSource: "ajax_table_arts.php",
oSelectSourceParams: {'action': "col_values"}
});
});

[/js]

HELP ME PLEASE

This question has an accepted answers - jump to answer

Answers

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394
    Answer ✓

    Check your console info for syntax error:

    aoColumnDefs: < 
                    { bSortable: false, aTargets: <1> } 
                >, 
    
  • artem4ik19artem4ik19 Posts: 10Questions: 2Answers: 0

    tnx tangerine. The problem was in Allow Javascript in posts and pages plugin for wordpress . When i insert js code to my page it change [] to <> . So i insert script to footer.php and it began to work))

This discussion has been closed.