How can I change the delimiter (comma) to semicolon for array type of data on a column.
How can I change the delimiter (comma) to semicolon for array type of data on a column.
gouravrathour007
Posts: 9Questions: 2Answers: 0
Hi Team,
How can I change the delimiter (comma) to semicolon for array type of data on a column?
This question has an accepted answers - jump to answer
Answers
Please provide more details about the problem you are trying to solve.
Kevin
A big thanks for your response.
Please refer attached screenshot as the screenshot, the library automatically changes the array type of data into a comma-separated string I want to replace the comma with a semicolon.
Thanks for clarifying. You can use
columns.render
to manipulate the displayed data. See the data rendering docs and this example for more details.Kevin
Thanks for the quick response!!
Can we do it globally not only for a specific column?
if the data type is an array just join the string with semicolons.
same as the grid is doing with comma.
You can use
columnDefs
and definecolumnDefs.targets
for thecolumns.render
function. You can define an array of columns or use_all
for all columns. However you can define only onecolumns.render
function per column.Or you can have the server return a string with semicolon separated values instead of an array.
Kevin
I found a solution finally, Thanks for your support.
can you tell me what you got the final solution?
{
targets: "_all",
render: (data, type, row, meta) => {
let value: any = "";
if (typeof data == "boolean") {
value = data ? "Yes" : "No";
} else value = data || "";
return "<span class='dtData'>" + value + "</span>";
}
}