datable jquery in APSNET CORE 5 - API to open the file??

datable jquery in APSNET CORE 5 - API to open the file??

SBD999SBD999 Posts: 36Questions: 1Answers: 0

Link to test case:
Debugger code (debug.datatables.net):

Description of problem:
I use datatable in aspnet.core 5. This table is fill with link of the file localised in server sql in table File Table.

The problem is to define the good api.

The configuration datatable :

$(document).ready(function () {
    $('#wSerieDatatable').dataTable({

        "processing": true,
        "serverSide": true,
        "filter": true,
        "ajax": {
            "type": "POST",
            "url": "/api/wSerie",
           "datatype": "data.json"
        },
        "columnDefs": [{
            "targets": [0],
            "visible": true,
            "searchable": true
        }],
        "columns": [
                 {
                "data": "name", "name": "Name", "autoWidth": true,
                render: function (data, type, row, meta) {
                    if (type === 'display') {

                        data = '<a href="/api/wSerie/path' + row.path+ '" >' + row.name + '</a>';
                    }
                    return data
                }
            },
            { "data": "file_type", "name": "Size", "autoWidth": true}
        ]
    });
});

Error messages shown:

It's clear that my API it's not good!

Do you have an example that uses datable jquery in APSNET CORE 5 and especially with the data stored on a sql server with a file table?
Thanks in advance!

Replies

  • kthorngrenkthorngren Posts: 21,344Questions: 26Answers: 4,954

    api/wSerie/pathundefined

    I assume this happens when you click the link in the name cell. The undefined is from row.path. This suggests that your row data doesn't have the path object resulting in the undefined. Use the browser's network inspector to see the Ajax response from the server. Does it contain a path object for each row?

    Kevin

  • SBD999SBD999 Posts: 36Questions: 1Answers: 0

    I resolve my issue by added Sql view. thnaks to your support.

Sign In or Register to comment.