maximilianh / cellBrowser

main repo: https://github.com/ucscGenomeBrowser/cellBrowser/ - Python pipeline and Javascript scatter plot library for single-cell datasets, http://cellbrowser.rtfd.org
https://github.com/ucscGenomeBrowser/cellBrowser/
GNU General Public License v3.0
104 stars 40 forks source link

Categorical data's name column isn't sortable #163

Closed detrout closed 2 years ago

detrout commented 4 years ago

Using 0.7.7 I added a categorical data set and discovered the Name column wasn't sortable.

It looks like onSortByClick in cellBrowser.js expecting the span that's clicked has an id that ends with Col1. setLegendHeaders adds some nested spans for the categorical data and the event passed to onSortByClick is pointing at

<span class="tpLegendHover" title="click to sort by name"> Name<span...

which has no id attribute

Since the sort test was just looking for an id that ends with Col1 I tried this patch which add an id "tpLgendedInnerCol1" to the span:

--- a/src/cbPyLib/cellbrowser/cbWeb/js/cellBrowser.js
+++ b/src/cbPyLib/cellbrowser/cbWeb/js/cellBrowser.js
@@ -4966,7 +4966,7 @@
     function setLegendHeaders(type) {
     /* set the headers of the right-hand legend */
         if (type==="category") {
-            $('#tpLegendCol1').html('<span title="unselect all checkboxes below" id="tpLegendClear">&#9746;</span><span class="tpLegendHover" title="click to sort by name"> Name<span class="caret"></span></span>');
+            $('#tpLegendCol1').html('<span title="unselect all checkboxes below" id="tpLegendClear">&#9746;</span><span class="tpLegendHover" id="tpLegendInnerCol1" title="click to sort by name"> Name<span class="caret"></span></span>');
             $('#tpLegendCol2').html('<span class="tpLegendHover" title="click to sort by frequency"> Frequency<span class="caret"></span></span>');
         }
         else {
matthewspeir commented 3 years ago

Hi, @detrout!

Is this still an issue in the latest version of the cell browser (v1.0)? From what I can tell, I can sort categorical metadata fields by "Name".

If it's working for you too, let's close this issue. If it's not working, maybe you can share some exact steps to replicate the error.

Thanks!

matthewspeir commented 2 years ago

Closing this ticket. Feel free to reopen if something still needs to be fixed here!