Displaying null int as empty " "

Displaying null int as empty " "

NewinthezoneNewinthezone Posts: 22Questions: 0Answers: 0
edited May 2012 in General
Hi
I have this issue where I am using server side processing. What is happening that if I have a integer type of column(in the sql) having nulls values , they are displayed as 0 in the data tables even though I check for null values and I dont assign them any value.
So by default ,they seem to be displaying 0. But I remember when I was using client side processing ,int columns with null values would be displayed as " "(empty) .
If I use string datatype and convert the int to string and display null int as empty string , that solves one issue but when it comes to sorting strings with numbers, it sorts in an unusual way. That is the correct ascending order for sort for numbers should be [0,1,2,3,4,5.. ] but it displays ascending order as [1,10,100,1000...] in case of string.
So how could I tell datatables to display null ints as " " or how could I sort strings with numbers in the the correct numerical way.

Replies

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Can you run your table through the debugger ( http://debug.datatables.net ) so I can see the data in your table. DataTables at the moment is picking your column up as string based, as it must have non-numeric data in it. It sounds like you might need a sorting plug-in to have empty strings sorted as required.

    Allan
  • NewinthezoneNewinthezone Posts: 22Questions: 0Answers: 0
    Hi allan

    Thanks for your reply , i got it to work . Server side is wonderful . I remember I couldnt get it to work earlier. But now its all cool
This discussion has been closed.