Help with Sorting Signed Data (Visually without the sign!)

Help with Sorting Signed Data (Visually without the sign!)

bellymanbellyman Posts: 1Questions: 0Answers: 0
edited October 2010 in General
I have a table where the values (numbers) are not signed - instead they are shown in "absolute" mode and prefixed with graphical arrows (up) or (down). I noticed in the plug-ins there is one to deal with sorting signed numbers.

For example instead of 3.25 and -6.25 it will show "UP" (image) and "3.25". And "DOWN" (image) and "6.25". Obviously sorting the values will not yield the results if I must rely on the visual column data. I was wondering if something like this would be possible or not.

~ The arrows are mandatory and the signs (-) (+/nothing) are not something I want.
~ I am wondering if there is a way to store a value in the tags and sort on that instead of the visuals (that way I could load the tags with -6.25 and show DOWN 6.25.
~ Another "thought" might be to use the arrows and do a two column sort. (not sure how that would work - would the "source name" of the graphic be used as the data to sort?)
~ An idea but the negative is that the arrow I assume would need to be in a fixed cell by itself. Right now I can show UP $12.25 and UP $12,100.00 and it looks pleasing to the eyes (arrow directly in front of the data) - having an arrow in a column to the left would be a slight bother - too much space from the number - the arrow would look like an orphan.
~ A stretch - an old Excel trick - can a column be loaded with data AND init HIDDEN AND be sorted? That way I could store (somewhere) "-6.25" and when I sort use that column (probably not).

I don't know enough to know if this is possible. Just trying to get past the discovery phase to see if this app would fit the bill or not.

One thing that caught my eye was the "show more record info" by pressing the button an having extra info pop up under the row. Very slick. I am showing extra info today in tooltips - it works but not the same.

Thanks
belly

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    There are a couple of ways of doing this (most involving sorting plug-ins, the other option is to use the column's iDataSort parameter). One option (if you have control over the process which is writing the HTML in the first place) is you use the hidden title numeric sorting plug-in: http://datatables.net/plug-ins/sorting#hidden_title . That will take the 'title' attribute from an empty (hence invisible) element and sort as needed. You just need to output the number into the format needed.

    Other options (I think all of the suggestions you make are actually possible), include looking at the HTML that is in the cell and rendering that into a number to be sorting, by using a sorting plug-in. Or iDataSort will will do the old Excel trick you mention.

    Sounds like a nice application - will you be able to post a public URL when the project is down so we can admire your work? :-)

    Regards,
    Allan
This discussion has been closed.