How to insert other column of the related table into DataTable using serverside processing

How to insert other column of the related table into DataTable using serverside processing

elenoraelenora Posts: 23Questions: 10Answers: 0

Hi. I'm implementing asp.net core 3.1. I have a DataTable and I want to load the data into it via ajax call like the following and it loads the data into it completely:

jQuery(document).ready(function ($) {

    $("#myDummyTable").DataTable({

        "processing": true, // for show progress bar
        "serverSide": true, // for process server side
        "filter": true, // this is for disable filter (search box)
        "orderMulti": false,


        "ajax": {
            "url": "MyData/GetData",
            "type": "POST",
            "datatype": "jason"
        },
        "columnDefs": [{
            "targets": [0],
            "visible": false,
            "searchable": false
        }],

         "columns": [
            { "data": "id", "name": "Id", "autoWidth": true },
            { "data": "name", "name": "Name", "autoWidth": true },
            { "data": "applicantId", "name": "applicantId", "autoWidth": true },

        ]

    });
});

But my problem is applicantId in the above column is a foreign key of another table called Applicant and i want that instead of applicantId which is number format, it show data of column 'Name' of the related applicantId from Applicant table here in MyData JQuery Datatable view. I appreciate if anyone suggests me how I can solve this.

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    You need to perform a left join to your Applicant table. This is the documentation for how to do that with our Editor server-side libraries for .NET, which you can use without an Editor license.

    Or if you are writing your own code for the server-side processing you need to have it perform that join.

    Allan

This discussion has been closed.