New line in the same row

New line in the same row

hercrosshercross Posts: 11Questions: 4Answers: 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:

{"data":"telefonos",
         "defaultContent":"",
         "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??

Thanks

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    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.

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 20,264Questions: 26Answers: 4,764

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

    Kevin

Sign In or Register to comment.