Setting parenthesis as a negative value

Setting parenthesis as a negative value

Adam84Adam84 Posts: 10Questions: 4Answers: 0

Hi, I have a number of tables that use parenthesis to represent a negative value and have been trying to get this to work within the 'Ignore text plugin' (link below).

http://www.datatables.net/forums/discussion/22343/new-sorting-plugin-sort-by-any-number-ignore-text.

I have tried replacing opening parenthesis with a minus symbol so that it reads the character as a negative value but this doesn't seem to have worked.

I've put a fiddle together as an example...

http://jsfiddle.net/Adam84/ot9doh27/1/

Any help is much appreciated!

Answers

  • allanallan Posts: 61,787Questions: 1Answers: 10,115 Site admin

    it looks like your regex (reg) is removing the parenthesis. I think you just need to add \(\) to your regex to have them included.

    Allan

  • Adam84Adam84 Posts: 10Questions: 4Answers: 0

    Hi Allan,

    I adjusted the regex and it look's like that has done the trick...

    http://jsfiddle.net/Adam84/ot9doh27/3/

    Thanks for your help!

This discussion has been closed.