Replacing "null" value

Replacing "null" value

satheshshivasatheshshiva Posts: 3Questions: 1Answers: 0
edited March 2011 in General
Hi..

I am using the latest version of the Datatables (1.7.6) with MySQL database. I am using the Ajax Source to get the Json data for the table. If there is a null value then the data table displays the string "null".

Please let me know how to replace this with the empty string "" without the string "null"My deadline is tomorrow for my project. So please help me out ASAP.

I am sorry if this question was answered in any other thread but I have really no time to check because of my project deadline. :(

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    DataTables should be treating null as an empty string already. This block in _fnAddData deals with that:

    [code]
    /* Allow null data (from a data array) - simply deal with it as a blank string */
    if ( aData[i] === null )
    {
    aData[i] = '';
    }
    [/code]
    So that suggests that perhaps the JSON data has "null" as a string rather than an actual null. The quickest way to get a accurate answer (other than making a donation of course :-) ) is if you could post an example please. Failing that, in this case the JSON return would be interesting.

    Allan
  • satheshshivasatheshshiva Posts: 3Questions: 1Answers: 0
    Oops.. Sorry My mistake. My Json itself is generated as "null" for empty values by my servlet..

    Another issue I am facing is that the Pagination type "full_numbers" appears to be very compressed with minimal width when I enable "bJQueryUI": true property. I use "Smoothness" theme of the jQuery.

    When I disable that the pagination appears to be fine. Am not sure where to change the width of the pagination.

    I tried changing the CSS width,
    [code]
    .dataTables_paginate {
    width: 50px;
    * width: 40px;
    float: right;
    text-align: right;
    }
    [/code]

    But no use. Please help me out.

    Is that anyway to share a screenshot right here?

    Thanks a lot.
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    No there isn't an attachment feature for this forum at the moment, but there is no shortage of options: http://lifehacker.com/#!388284/best-online-file-sharing-services :-)

    Are you using the demo_table_jui.css file which comes with DataTables? If so it should look like the demo table here: http://datatables.net . Firebug might be useful for figuring out where the styles are coming from.

    Allan
This discussion has been closed.