how takes multiple object in datatable

how takes multiple object in datatable

fanomezanafanomezana Posts: 3Questions: 0Answers: 0

I return this in the controller.
return Json(new { listOfPath = test, data = listUser, draws = draw, recordsFiltered = recordsTotal, recordsTotals = recordsTotal }, JsonRequestBehavior.AllowGet);

in the column:
"columns": [
I can display object data
]
How takes object listOfPath in this column ??

Replies

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    Can you post some of the actual JSON that gets created, that would help understand the issue.

    Colin

  • fanomezanafanomezana Posts: 3Questions: 0Answers: 0
    edited February 2020

    this picture show that the result by controller is successfully

    In the script:

    var oTable = $('#ListEvaluation').DataTable(
    {

                    "serverSide": true,
                    "Processing": true,
                    "ajax":
                    {
                        "url": "@Url.Action("getListFilterSecond","EvaluationEquipe")",
                        "type": "POST",
                        "dataType": "JSON",
    
                    },
                    "columns": [
                        { "data": "PRENOM" },
                        { "data": "SERVICE", "name": "SERVICE", "autoWidth": true },
                        { "data": "DEPARTEMENT", "name": "DEPARTEMENT", "autoWidth": true },
                        { "data": "MATRICULE", "name": "MATRICULE", "autoWidth": true },
                        { "data": "POSTE", "name": "TITRE", "autoWidth": true },
                        { "data": "ANNEE", "name": "ANNEE", "autoWidth": true },
                    ]
                }
    
            );
        });
    

    It run successfully but I want take listPath in this columns.

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    It's different to the main object, so you would need to blend it in. You could try in columns.render, call ajax.json() to get the last JSON response, and parse it yourself.

    Colin

  • fanomezanafanomezana Posts: 3Questions: 0Answers: 0

    Thank you very much, I will try it

This discussion has been closed.