fndraw not working

fndraw not working

NewcomaNewcoma Posts: 24Questions: 0Answers: 0
edited December 2013 in General
I'm using the datatables plugin and want to reload the sorting of the table columns by the click of a button. I'm changing the content of the table clientside. But nothing happens when I click redrawBtn. Everything else is working properly.

// datatable config
var oTable = tablesorterEl.dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": false,
"bRetrieve": false,
"asSorting": true,
"bServerSide": false,
"bSearchable": true,
"aaSorting": [],
"oLanguage": {
"sSearch": ""
},
"bStateSave": true
});

// redraw button
$('.redrawBtn').click(function(){

oTable.fnDraw();
});

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    edited December 2013
    Please link to a get case as noted in the forum rules.

    Allan
  • NewcomaNewcoma Posts: 24Questions: 0Answers: 0
    Here is an example http://live.datatables.net/eyijid/10/edit#javascript,html

    The remove button will remove the '6' from the first column but the redraw button will not sort th first column differently.
    Hitting the sort arrow on the first column will not sort correct either.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You are manipulating the DOM without telling DataTables. See: http://datatables.net/faqs#append . Basically you need to use the API so DataTables knows that something has changed.

    Allan
This discussion has been closed.