fnUpdate Sort alt-string

fnUpdate Sort alt-string

nachtkrabnachtkrab Posts: 1Questions: 0Answers: 0
edited September 2012 in General
Hi guys,

I use alt-string to sort a column with two different images, they have class a and b. On clicking the image, the entries visibility is triggered. After success the image is updated and the class changed to either a or b. This works fine, but the sorting isn't working after that.

As the script was already exisiting before datatables, I didn't use fnUpdate to update my class but normal jQuery instead. On the forums I found out that sorting is only working if I use fnUpdate, so I use fnUpdate to reparse the new code so that it's visible to datatables, but still not working. Here's the code.

One comment on the removeClass lines: I remove and add the classes in the right order, because alt-string uses the order of the class. This should not be the problem as it's the right order (already checked it)

[code]

// var id contains the id of a span inside the td


$.getJSON('index.php',
{
//my Params, deleted it because it's not necessary for the example
},

function(data) {

if(data == 1) {
jQuery('#'+id).removeClass('b');
jQuery('#'+id).removeClass('enabled');
jQuery('#'+id).removeClass('clickable');
jQuery('#'+id).addClass('a');
jQuery('#'+id).addClass('hidden');
jQuery('#'+id).addClass('clickable');

}
else {
jQuery('#'+id).removeClass('hidden');
jQuery('#'+id).removeClass('a');
jQuery('#'+id).removeClass('clickable');
jQuery('#'+id).addClass('b');
jQuery('#'+id).addClass('enabled');
jQuery('#'+id).addClass('clickable');
}


td = jQuery('#'+id).parent();

pos = oTable.fnGetPosition(td[0]);
sData = td.html();

oTable.fnUpdate( sData, pos[0], pos[1] );

});
[/code]
This discussion has been closed.