use selected only specfic rows from ajax response and group them

use selected only specfic rows from ajax response and group them

nbayoungcodenbayoungcode Posts: 1Questions: 1Answers: 0

i'm using ajax to populate my table, what i need is to select only some rows of the ajax response, and group some, something like this:

AJAX response:

{
    "draw": 1,
    "recordsTotal": 10,
    "recordsFiltered": 10,
    "data": [
        {
            "id": 1,
            "name": "Nba youngboy",
            "phone1": "123",
            "phone2": "456",
            "phone3": null,
            "phone4": null,
            "phone5": null,
            "email1": "nbayoung@email.com",
            "email2": "nbayoungboi@hotmail.com",
            "email3": "youngnigga@mail.com",
            "email4": null,
            "email5": null,
            "notations": "gang shit",
            "created_at": "2018-07-01 00:25:35"
        },

the table has name, email, phone and notations as rows, what i want to do is to group the non empty rows as one, for eg:

phone1 and phone2 aren't empty, so they became only 'email', "email:"phone1<br>phone2", and the same goes for email, "email":"nbayoung@email.com<br>nbayoungboi@hotmail.com<br>youngnigga@mail.com", its possible to do it?

current settings:

                    $(".datatable-ajax").dataTable({
                            "processing" : true,
                            "serverSide" : true,
                            "order" : [],
                            "ajax" : {
                             url:"",
                             type:"POST"
                         }

sorry for my bad english.

Answers

This discussion has been closed.