Issue while sorting table using table sorter plugin

Posted by Sahoo under jQuery on 1/28/2012 | Points: 10 | Views : 1587 | Status : [Member] | Replies : 2
Hi,

I am using a table sorter plugin to sort a table generated dynamically.Some time it is working fine and sometime not .I have mainly following issues:
1-Same time I am not able to sort ascending and descending order for same column.Means if I sort column 1 in ascending order then I am not able to sort it in descending order unless I sort
column in .After sorting column 2 then I am able to sort column 1 in descending order.
2-if no rows r present then it is showing error " type is undefined".

But issue no 1 is occurring only when table has odd no of rows.Although previous rows after updates are not visible in web page,But they are remaining in table which can be seen by developer tool.Need your suggestion.

Thanks in advance.




Responses

Posted by: Blessyjees on: 1/30/2012 [Member] Bronze | Points: 25

Up
0
Down
hi,

could you provide your code.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sahoo on: 1/31/2012 [Member] Starter | Points: 25

Up
0
Down
Thank u 4 ur interest in this issue.
my code are
function sortTable() {
$("#table").tablesorter({
headers: {
1: { sorter: "digit" }, // sort size column numerically
2: { sorter: false },
3: { sorter: false }
}
});
$("#table").bind("sortEnd", function () {
$("#table tr").removeClass('tdOdd');
$("#table tr").removeClass('tdEven');
$("#table tr:odd").addClass('tdOdd');
$("#table tr:even").addClass('tdEven');

});
return false;
}

after dynamically modifing table i am eecuting following code

$('#DocTemplate').tmpl(obj).appendTo('#table');
$("#table tr:odd").addClass('tdOdd');
$("#table tr:even").addClass('tdEven');
$("#table").trigger("update");
var sorting = [[0, 0]];
$("#table").trigger("sorton", [sorting]);


It is showing above issue.

It also crashes when I add row to an empty table.

need your suggestion.

Sahoo, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response