clinical-timeline
clinical-timeline copied to clipboard
Hide splitted track does not work if tracks have the same name
We expect the initial tracks to have different names, but it is possible that a split track might have the same name. Currently the track that is hidden is always the first one instead of the one that was clicked on:
Problem
First splitted track with same name is hidden
Expected behavior
The splited track clicked on should be hidden
I am not sure it this is a straight-forward bug fix. If I am missing something please let me know.
We are getting the innerHTML
of the particular element and then passing it over to the getTrack
function which returns the first element of the array which matches with the said track name(from the data). I am uncertain on how to map the clicked element with the data since from the HTML side we only have access to the innerHTML
and that is not unique.
Any ideas?
It looks like a more tricky problem than anticipated. It would require some changes to the API i.e. toggleTrackVisibility and getTrack should use more than just the track name. Maybe we could change it to work in such a way that when the given input is a string it will use the name, but when you supply an object e.g. {label:trackname,split:true}
it will use underscorejs' where http://underscorejs.org/#where
Another way would be to bind the data using D3 to the label/add track button and set the visible attribute to false or true. I will try to break this issue down a bit more. Thanks for looking into it