≡
×
Plus
Manual
Examples
Reference
Download
Blog
Community
Support
Formatting boolean fields
Formatting boolean fields
skyetech
Posts: 10
Questions: 0
Answers: 0
February 2012
edited February 2012
in
General
I'm retrieving records from a database using json. The boolean fields come back as True/False. I'd like to display Yes/No instead. How would I do that in Datatables? Thanks.
Replies
allan
Posts: 65,846
Questions: 1
Answers: 10,956
Site admin
February 2012
Three options:
1. Use your server-side script to modify the data before it is sent to the client.
2. Use
fnRender
to render the string as you wish.
3. Use
mDataProp
as a function (must the same as fnRender, but you get more control over the different data types - sorting, filtering, display etc).
Option 2 is probably the easier to implement as it will just take a couple of lines of code.
Allan
skyetech
Posts: 10
Questions: 0
Answers: 0
February 2012
fnRender worked. Thanks.
This discussion has been closed.
Replies
1. Use your server-side script to modify the data before it is sent to the client.
2. Use fnRender to render the string as you wish.
3. Use mDataProp as a function (must the same as fnRender, but you get more control over the different data types - sorting, filtering, display etc).
Option 2 is probably the easier to implement as it will just take a couple of lines of code.
Allan