Removing cell data

Removing cell data

asingh18asingh18 Posts: 4Questions: 2Answers: 0

Im trying to remove some repeating cell data to clean up data presentation.

         $('#result').DataTable({
            "serverSide":true,
            "filter": false,
            "orderMulti": false,
            "ajax": "DetailedSearch?handler=ServerSideDataTable",
            "columns":[
                {"data": "location", 
                 "render": function(data,type,row){
                     return row.location;
                 }
                },
                {"data": "contactAndRole", 
                 "render": function(data,type,row){
                     return data.key + " - " + data.value;
                 }},
                {"data": "server", "sortable": "false"},
                {"data": "urls", 
                 "render": function(data,type,row){
                     return row.urls.join('<br/>')
                 }
                }
            ],
             rowGroup:{
                dataSrc:'appName'
            }
        });



        
            console.log($('#result').DataTable());


            var data = $('#result').DataTable().rows().data();
            console.log(data.length);
            data.each(function (value, index) {
                console.log(`For index ${index}, data value is ${value}`);
            });

Im trying to use the each or every function on all rows in my data table to try and isolate the col with repeating info, and remove all but one per col.

My issue is each and every are not working at all. I dont know if im saving my table to a variable in the wrong fashion, but when i check the length of data its 0.

Replies

  • kthorngrenkthorngren Posts: 20,254Questions: 26Answers: 4,761

    The problem is probably that with the ajax call the loop is being executed before the ajax response. Also you are using server side processing so only one page of data is at the client. I think the rowCallback option should work for you.

    Kevin

This discussion has been closed.