Support

Account

Forum Replies Created

  • The loop is fine.

    The problem is that the jQuery table I’m using (was using, Im trying a different script now) to SORT the data is confusing the parsed numbers with commas as regular strings, not as numbers/values so it orders as 1,100, 1000,2, 20, 2222, 6 instead of 1,2,6,20,100,1000,2222

    The problem seems to be that converting the string with <?php echo number_format( floatval( get_field(‘revenue_number’) ), 0, ‘.’, ‘,’ ); ?> confuses the sorter.

    If I don’t convert it and just use the regular the_field call, it sorts properly.

    I don’t know if there’s a way to call the conversion in the loop prior to the while/loop or if there’s a different way to convert the output

  • Yes, It’s going into the db table as a plain number. 1000000
    I want to display it with commas. 1,000,000

  • Sorry John that’s a typo, I fixed it. It’s correct in the template code.
    (The loop wouldn’t give any values if it was missing)

    Anyway, it seems that the echo number_format adjustment is what confuses the sorter so that it’s treated like a regular string and not a number/currency which is problematic. The commas need to be parsed in before not after. Arg.

Viewing 3 posts - 1 through 3 (of 3 total)