New line in the same row

New line in the same row

hercrosshercross Posts: 12Questions: 5Answers: 0

Hi, I have a Datatabe with some values..

I get the values from ajax, I get number1<br/>number2<br/> like value.

I need each number in different lines inside the same row.

In the Datatables configuration, I'm using render to try make it, like this:

         "render":function(data, type){
          var brExp = /<br\s*\/?>/i;
          var oData = data.split('<br/>');
          Data = oData.filter(el => el !== '');
          for(let value of Data){
            return '<a class="call_telefonos" style="color:red;" href="javascript:void(0)">'+value+'</a>';

If I get out with console.log('<a class="call_telefonos" style="color:red;" href="javascript:void(0)">'+value+'</a>'), I can see new <a> by each numer, perfect..

But in the return, only see the first <a> each group of numbers, never see like console.

What am I doing wrong? Why cannot I create a new line by each number??



  • colincolin Posts: 15,207Questions: 1Answers: 2,592

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.



  • kthorngrenkthorngren Posts: 20,584Questions: 26Answers: 4,823

    Is this the same question you have in this thread. Please don't duplicate questions. See my answer in your other thread.


Sign In or Register to comment.