Ajax handler is not invoked in DataTables

Ajax handler is not invoked in DataTables

JuniusJunius Posts: 1Questions: 1Answers: 0

Hi, I'm a newbie in using jQuery DataTables plugin. I have this script below for the DataTable initialization.

<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        var oTable = $("#tblFile").DataTable({
            "iDisplayLength": 10,
            "bServerSide": true,
            "sAjaxSource": "@Url.Content("PlayListFilesAjaxHandler")" + "?playListId=" + getParameter(),
            "bProcessing": true,
            "bStateSave": true,
            "aoColumns": [
                {
                    "sName": "FileName",
                    "bSearchable": true,
                    "bSortable": true,
                    "sWidth": '25%'
                },
                {
                    "sName": "FilePath",
                    "bSearchable": true,
                    "bSortable": true,
                    "sWidth": '50%'
                },
                {
                    "sName": "Order",
                    "bSearchable": true,
                    "bSortable": true,
                    "sWidth": '10%'
                },
                {
                    "sName": "Action",
                    "bSearchable": false,
                    "bSortable": false,
                    "sWidth": '15%',
                    "render": function (data, type, full, meta) {
                        return '<a class="btn btn-primary deleteButton" href=\"FileDelete/' + full[3] + '\">Delete</a>';
                    }
                }
            ]
        });
    });
</script>

My problem is that I'm not sure if using the line below will eventually invoke the action method PlayListFilesAjaxHandler in my controller class.

"sAjaxSource": "@Url.Content("PlayListFilesAjaxHandler")" + "?playListId=" + getParameter()

Below I have two parameters for the said method

public ActionResult PlayListFilesAjaxHandler(string playListId, JQueryDataTableParamModel param)
        { ..... }

I'm stuck on this one because, PlayListFilesAjaxHander method is not invoked when the above script is being executed.

Any help is greatly appreciated.

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Honestly, I have no idea! That's really a .NET question and you'd be better asking on Stack Overflow or similar as I'm no wizard as .NET stuff.

    Allan

This discussion has been closed.