Add Link Column to DataTable

Add Link Column to DataTable

goraazgoraaz Posts: 1Questions: 1Answers: 0
edited January 2019 in Free community support

I have a datatable in which the data (from the database) is being filled with ajax, I also want a new tablerow with "Details" to show more details , but the table only allows data from the database.

I also read all documentation , but still no luck :(

              <table id="OrdrerList">
                    <thead>
                        <tr>

                            <th>Name</th>
                            <th>Details</th>

                        </tr>

                    </thead>
                    <tbody>
                    </tbody>
                </table>
    $('#OrdrerList').DataTable({

        "processing": true,
        "serverSide": true,

        ajax: {
            url: '@Url.Action("GetClosedRMA", "User")',
            dataType: 'json',
            contentType: 'application/json; charset=utf-8',
            data: 'dataSet'

        },
        columns: [

            { data: "Name" },
            { data: What should be here ? Details is just text and its not coming from database, 
             "render": function (data, type, full, meta) {
             return '<a href="/User/RMAClose?Name=' + full.Name+ '">some text</a>';
          } }
            
        ]
        "order": [0, "Asc"]

    });

Answers

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

    Hi @goraaz ,

    I assume you want the additional row to be a child - see this blog post here, it shows how to use ajax to get that detail.

    Cheers,

    Colin

This discussion has been closed.