How to make datatables doesn't show $NaN.N when null value

How to make datatables doesn't show $NaN.N when null value

ezrachenezrachen Posts: 12Questions: 4Answers: 0

Hi

My code like:
@:{ data: "yield@(i.ToString())", render: $.fn.dataTable.render.number('', '.', 4, '%') },
When the cell is null, it will show "NaN", how to make it doesn't show anything ?

Thanks! Best Regards!

Answers

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin

    Could you try using the DataTables nightly from the downloads page please. It has an update to handle null data in the number renderer. You should also set columns.defaultContent to tell DataTables how to display null data.

    Thanks,
    Allan

  • ezrachenezrachen Posts: 12Questions: 4Answers: 0

    columns : [
    { data: "yield0", defaultContent: ".", render: $.fn.dataTable.render.number('', '.', 4, '%') }
    ]

    but no effert

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin

    Could you link to the page you are using so I can debug it directly please?

    Thanks,
    Allan

  • ezrachenezrachen Posts: 12Questions: 4Answers: 0

    Hi Allan

    Sorry, I forget your message. My website is my company private website. Outer can't connect it. Are there another way to trace by myself ?

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin

    Could you use http://live.datatables.net , JSFiddle, CodePen or any other similar service to create a test page so I can debug it please?

    Thanks,
    Allan

  • ezrachenezrachen Posts: 12Questions: 4Answers: 0

    Hi Allan

    I have link to //live.datatables.net and past my html and js into it. And I can look out.
    But I doesn't know how to save. So I just "Save as template".

    Or you have mail, I mail the html page to you.

    Thanks! Best Regards!

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin

    It will automatically save and you just copy / paste the URL.

    Allan

  • ezrachenezrachen Posts: 12Questions: 4Answers: 0

    Hi Allan

    The URL is my company's private address. Outside can't arrive it. I have made a html file with all table data, and javascript code to wrapper the table by datatable. I can send the file to you by mail.

    Thanks!

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin
    edited April 2015

    The URL should be something like http://live.datatables.net/bequgeje/1/edit if you have used http://live.datatables.net/

  • ezrachenezrachen Posts: 12Questions: 4Answers: 0

    Hi Allan

    I have found When render option is "render: $.fn.dataTable.render.number(',', '.', 4, '$')", the defaultContent option don't function.

    Thanks!

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin

    That should be resolved with the 1.10.6 release. Although I can't say for certain without a test case to try it out myself with your data and configuration.

    Allan

  • jarturjartur Posts: 1Questions: 0Answers: 0
    edited September 2015

    I can't find solution yet

  • allanallan Posts: 63,678Questions: 1Answers: 10,498 Site admin

    @jartur - To what? Have you the same issue as described in this thread? If so, please follow the forum rules and post a link to a test page showing the issue.

    Allan

This discussion has been closed.