ravid7000 / table-sortable

A jquery plugin to sort and paginate data in table form.
https://table-sortable.now.sh
MIT License
35 stars 14 forks source link

formatCell and formatHeader Methods are not working properly. #11

Closed theamit-009 closed 3 years ago

theamit-009 commented 4 years ago

var table = $('#table-sortable').tableSortable({ ... formatCell: function(row, key) { if (key === 'formCode') { return $('span').addClass('bold').text(row[key]); } if (key === 'fullName') { return $('span').addClass('uppercase').text(row[key]); } // Finally return cell for rest of columns; return row[key]; }, ... });

It only Updates the last row. and add spans consecutively.

arobert3434 commented 4 years ago

I didn't have a lot of success altering assumed spans like this or in the doc example. But just returning plain HTML or text strings works fine.

amitkumarjain2 commented 3 years ago

yes, this is true, formatting cell and headers not working. Also If if want to make a clickable button in each row how can we achieve this? for example, I want to different page on each row by clicking on link.

ravid7000 commented 3 years ago

Documentation updated https://table-sortable.now.sh/story-latest.html#formatCell https://table-sortable.now.sh/story-latest.html#formatHeader

You have to return newly created html from the functions.