• Resolved digibobdeluxe

    (@digibobdeluxe)


    Hi!

    Loving this plugin and when I have this working fully, I will pay for it and the 2 extensions I have used – I just need to get it working first ??

    I have a table being embedded using the Table Auto Update and Responsive Tables extensions, and it is working great apart from one thing, I still cannot get a number coming from the CSV file to convert into thousands. I have tried this for a couple of days now (literally!) before coming here.

    The CSV loads in every hour and the numbers I want to convert into thousands separators automatically change every hour, so it needs to be dynamic.

    For example, the number 9826999.33 needs to be 9,826,999.33 – but no matter what I do, I can’t get it working.

    I need to have this working across the whole table which has the ID #tablepress-3

    I have the DataTables set up and my latest header script is :

    <script type=”text/javascript”>
    $(document).ready( function () {
    $(‘#tablepress-3’).DataTable(

    {
    “searching”: false,
    “ordering”: false,
    “paging”: false,
    “info”: false,

    “columnDefs”: [ {
    “render”: $.fn.dataTable.render.number( ‘,’, ‘.’ )
    } ]

    }
    );
    } );
    </script>

    The table is here – https://veganetf-demo.co.uk/ the first table on the right, scrolling down called Fund Data and Pricing.

    The CSV file is being loaded from here – https://veganetf-demo.co.uk/vegn-csvs/BeyondAdvisors-DailyNAV-Demo.CSV

    But no matter what I do, the number never changes.

    Is it because the number is coming straight from the CSV file from the external URL and is being presented immediately and nothing I do with effect it? This is the one reason I can see why I haven’t managed this.

    · Website: https://veganetf-demo.co.uk
    · TablePress: 1.9.1
    · TablePress (DB): 37
    · TablePress table scheme: 3
    · Plugin installed: 2018/12/17 10:33:24
    · WordPress: 4.9.9
    · Multisite: no
    · PHP: 7.0.33
    · mysqli Extension: true
    · mySQL (Server): 5.1.73
    · mySQL (Client): mysqlnd 5.0.12-dev – 20150407 – $Id: b5c5906d452ec590732a93b051f3827e02749b83 $
    · ZIP support: yes
    · UTF-8 conversion: yes
    · WP Memory Limit: 40M
    · Server Memory Limit: 256M
    · Magic Quotes: off
    · WP_DEBUG: false
    · WP_POST_REVISIONS: true

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    From what I can see, this is more a DataTables question, as you are manually loading the library. However, the fix should be to add a targets attribute to your columnDefs:

    "columnDefs": [ {
        "render": $.fn.dataTable.render.number( ',', '.', 2, '$' ),
        "targets": [ 1 ]
    } ]
    

    However, it might then also be possible that this will not really work because your second column uses different data types (like numbers and dates).

    Regards,
    Tobias

    Thread Starter digibobdeluxe

    (@digibobdeluxe)

    Hi Tobias!

    Many thanks for that rapid response!

    I tried your method and it worked on one of the numbers but not the other, so I did some more experiments and finally got something to work, although every number has been put to two decimal places, I’m hoping the client will be OK with it!

    I used ‘-all’

    “columnDefs”: [ {
    “render”: $.fn.dataTable.render.number( ‘,’, ‘.’, 2 ),
    “targets”: ‘_all’
    } ]

    If they approve, I’ll make the contribution to your fine work ??

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    great! Good to hear that this helped, at least partially!
    From what I can see, the Rate Date column is now wrong ??

    Regards,
    Tobias

    Thread Starter digibobdeluxe

    (@digibobdeluxe)

    Ah, that date is meant to be yesterday’s date – so hopefully that is what you mean!

    ??

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    When I last checked, I didn’t see a date in that cell, but a number. But it looks like you restructured the tables so that everything looks fine now ??

    Regards,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Thousands Separator from Dynamic CSV file’ is closed to new replies.