2

I am aware that bootstrap took out the ability to sort a table in their 2.0. I was looking online for a solution for my sorting problem and I found the following nice script http://www.kryogenix.org/code/browser/sorttable/

The issue that I am having right now is that the arrows (for sort in a ascending/ descending order) are not appearing right away, only after the user clicks once on the table they will appear. But the user will never know he or she can click to sort without seeing an icon to begin with.

I played with this part that has to do with the icons.

  sortfwdind.innerHTML = '<span class="ui-icon ui-icon-triangle-1-s"></span>';
  sortfwdind.className = "ui-icon ui-icon-triangle-1-s";

But i could not make it present an initial icon before the first click. Any suggestions?

2

2 Answers 2

2

That library is using pure HTML to insert the row after the table header. Look for:

sortrevind.innerHTML = stIsIE ? '&nbsp<font face="webdings">5</font>' : '&nbsp;&#x25B4;';

in the source code. You may want to just add '&nbsp;&#x25B4;' after each table header (to have the arrow before first click) and then edit its innerHTML and delete that icon in the click event.

Sign up to request clarification or add additional context in comments.

Comments

1

See http://www.kryogenix.org/code/browser/sorttable/#symbolsbeforesorting in the sorttable documentation for one way to do this.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.