negative number markup for readHTML
Brought to you by:
pcxuser
The readHTML could be improved by allowing it to add a
negative class to the span around each piece of data if
it really is negative. the option would specify which
columns to check. For each column it would add the
negative class if the number is negative.
If the column is not a number then what do we do?
Should we also add a positive class and what about a
zero class?
Logged In: YES
user_id=236631
The format of the negative number might also be affected but
that's more than just adding a class. The user can always
use css and dhtml to change the numbers by selecting all
spans having the negative class.
Logged In: YES
user_id=27290
Is the negative positive and zero classes something the user
is allowed to specify to the readHTML method or are you
wanting me to output:
<span class="column_name negative">-1.50</span>
<span class="column_name positive">1.50</span>
<span class="column_name zero">0.00</span>
where column_name is the result of running that columns name
through the fixupAttributes() method provided by the
DBIWrapper module.
Logged In: YES
user_id=236631
i would be happy if the data is just marked with something.
Letting the user specify exact class names is not really
important. the classes postivive, negative, zero are very
meaningful.
Logged In: YES
user_id=27290
Do we want to call them sqlPositive, sqlNegative, sqlZero or
some other prefix so that we don't potentially clobber a
class that someone may have created for a totally different
reason?
Possibly numPositive, numNegative, numZero?
I like the num version better since it is specifying that we
are talking about numbers and not something else that may be
positive or negative.
Logged In: YES
user_id=27290
Do we want to detect and differentiate between ints and floats?
Logged In: YES
user_id=236631
I think we are getting feature creep here. No I dont think
it's neccessary to do any of these things. If we want to be
safe we can allow the user to override the classNames but I
dont think that is neccessary right now. I dont think the
class names need to have num or sql appended but I'm not
willing to fight about it. Just implement something.
Logged In: YES
user_id=236631
I realized today that I am formatting the output of my
numbers to have commas etc. That might affect the perl code
when doing comparisions for postive/negative etc. keep in
mind when implementing this feature that commas may need to
be stripped out and that in europe commas and decials are
swapped.