Hi Matt,
How do I add a percent sign to grid column entries but still preserve to sorting, I would do this with Column Formatting/Html Expression = #COLUMN_NAME#% outside of FOEX, but this does't seem to work with FOEX.
Thanks
Alan
Yes thanks that works when the PCT data is in an identifiable column. The other situation I have is where one row of numbers in a report are percentages, but the preceding and proceeding rows are not. Any ideas?
Thanks Alan
Is it possible to add the % in the actual data within the report query?
e.g. SELECT CASE WHEN row_is_pct THEN col1||'%' ELSE to_char(col1, '999G999D00') END
Yes that is what I started with , but we've also got a requirement to colour negative numbers (and percentages!) in red, which is achieved through JS in the page header. When you add % in the query, the JS doesn't recognise it as a number and the colouration fails. I'm sure there's a JS way around this, but I haven't managed t get it working yet. Any suggestions glady accepted!
How about you do the following to the value within the renderer (which is a string)
value = parseFloat(value.replace(/(%|,)/,''),10)
e.g. here's the test
parseFloat('999,999.014545%'.replace(/(%|,)/,''),10)
There is a row highlighting example on page 3005 in the documentation applciation.
The "getRowClassFn" JS function in your page header you should modify to strip the % sign using the script snippet I provided. e.g.
var getRowClassFn = function (record, rowIndex, rowparams, store) { var price = parseFloat(record.get("LIST_PRICE").replace(/(%|,)/,''),10); var cssClass; if (price < 100) { cssClass += " price-ok"; } return cssClass; }
You can add % within a number format mask on the column e.g. 999% or 999D00%
and here's how it will look:
I didn't really understand what you meant in your latest comment. I've solved this using a DA and some Jquery.
Thanks for your help