Does anyone have an example of using the unique() function?
Does anyone have an example of using the unique() function?
jawz302
Posts: 15Questions: 5Answers: 0
I would like to make a specific column only display an End Model once. Or is there a way to pull the data into the Datatable using Select Distinct in the query, maybe?
This discussion has been closed.
Answers
Hi @jawz302 ,
Here's an example of
unique()
here.If you want to remove rows, to only show unique values in a certain column, you would need to use
row().remove()
, as I don't believe there's any other way of hiding it.Hope that helps,
Cheers,
Colin
Does unique even do what I am trying to do which is not displaying duplicate records in a specific column?
I cannot for the life of me figure out where to place it in my code.
I'm not sure what this means but if you have duplicate data in a column you might be able to use
columns.render
to display the data once.This would be up to your server script and database. Probably the way I would go if possible.
Kevin
Yep,
unique()
isn't what you want, or not on its own at least. As Kevin said, the best place to ensure uniqueness in the data is for the server to do that kind of stuff, and only send what it wants displayed. If you have to do it on the client, you can either manipulate the Ajax response, removing duplicate rows before it gets passed on to DataTables, or aninitComplete
orinit
callback.Cheers,
Colin