Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glyphicon not visible in column selector panel #1335

Closed
ptijul opened this issue Dec 14, 2016 · 6 comments
Closed

Glyphicon not visible in column selector panel #1335

ptijul opened this issue Dec 14, 2016 · 6 comments

Comments

@ptijul
Copy link

ptijul commented Dec 14, 2016

Hi,

My employer have asked me to replace some HTML column name by their corresponding glyphicon (used everywhere in our platform and really straightforward).
However, I see the glyphicon is not displayed.

A demo is visible here (check with the first column to demonstrate the problem but in my case I'm going to about 10 columns).

@Mottie
Copy link
Owner

Mottie commented Dec 14, 2016

Hi @ptijul!

The columnSelector currently only grabs the text from the headers, then uses the template in the columnSelector_layout option. It wouldn't be difficult to grab the HTML instead, but I'm not sure if that would always be ideal.

I would have to add a new option to include HTML, or maybe only include HTML if the header is empty... I think the second approach sounds better to me.

@Mottie
Copy link
Owner

Mottie commented Dec 14, 2016

The fix is in the master branch... I'm still not sure when the next patch will be released.

@ptijul
Copy link
Author

ptijul commented Dec 14, 2016

Hi @Mottie !

Wow thanks a lot for this very quick fix. The second option is good as the default.
If one wants to use the html even if there is text in the header text, how can we adapt the columnSelector_layout option?
Best regards

@Mottie
Copy link
Owner

Mottie commented Dec 14, 2016

Actually, I forgot about the data-attribute... you could also do this (demo):

<th rowspan='2' data-selector-name="<i class='glyphicon glyphicon-user test'></i>">
  <i class='glyphicon glyphicon-user'></i>
</th>

So, I think I'll actually revert this last update and add a callback function instead. This would give you much more control over the content added to the column selector popup (demo).

columnSelector_layoutCustomizer: function($cell, name, index) {
  // return the HTML for the first column only
  return index === 0 ? $cell.html() : name;
}

* Note the $cell jQuery object would point to the div inside each header cell (class name of "tablesorter-header-inner").

@ptijul
Copy link
Author

ptijul commented Dec 16, 2016

It's very nice with the data-attribute. I'm doing like this.
Thanks for the release, the timing fits perfectly my timing ;-)
Thank you for the 2 demos

Note : The version is still 2.28.1 instead of 2.28.2 (row 11 and 35 from tablesorter.js). I updated manually on my side but I just wanted to let you know.

@Mottie
Copy link
Owner

Mottie commented Dec 16, 2016

Thanks for letting me know about the version number.. v2.28.3 is now available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants