render string values comma separated adding space after comma and capitalize
render string values comma separated adding space after comma and capitalize
I'm trying to add a custom renderer for a column (regions) that has a string that looks like..
toronto,montreal,tokyo...
I would like to render it in the datatable as
Toronto, Montreal, Tokyo
So capitalize first letter and add a space after each comma. Is this possible via renderer?
I could use jquery to add the space after comma with
string.split(',');
And some css to capitalize but Ideally I would rather use renderer to customize everything.
This question has an accepted answers - jump to answer
Answers
There is nothing built-in, that I know of, to Datatables or Javascript to do this automatically. I would look at using `str.split(',') as you noted then loop through that array and capitalize each word. There are lots of ways to do this but I would probably do something like this:
Kevin
If anybody is having trouble with this I was able to fix it with the following code using render.
Thanks again @kthorngren