获取jQuery DataTables中的复选框ID

时间:2015-07-17 08:28:30

标签: javascript jquery datatables

在下面的代码中,我有一个jQuery DataTables,我想获取选定的行ID并将其存储到数组中。

function LoadData() {
    $('#tblNewSearch').dataTable({
        "oLanguage": {
            "sZeroRecords": "No records to display",
            "sSearch": "Search"
        },
        "aLengthMenu": [
            [ 10, 25, 50, 100, 150, 250, 500, -1 ],
            [ 10, 25, 50, 100, 150, 250, 500, "All" ]
        ],
        "iDisplayLength": 10,
        "bSortClasses": false,
        "bStateSave": false,
        "bPaginate": true,
        "bAutoWidth": false,
        "bProcessing": true,
        "bServerSide": false,
        "bDestroy": true,
        "sAjaxSource": "School.aspx/GetData",
        "bJQueryUI": true,
        "sPaginationType": "simple",
        "bDeferRender": true,
        "fnServerData": function (sSource, aoData, fnCallback) {
            $.ajax({
                "dataType": 'json',
                    "contentType": "application/json; charset=utf-8",
                    "type": "POST",
                    "url": sSource,
                    "data": "{}",
                    "success": function (msg) {
                        var json = jQuery.parseJSON(msg.d);
                        fnCallback(json);
                        $('#tblNewSearch').show();
                    }
                });
            },
            "aoColumns": [{
                "mDataProp": "SchoolID",
                "bSearchable": false,
                "bSortable": false,
                "sWidth": "10%",
                "mRender": function (data, type, full) {
                    val = '<input type="checkbox" id="chkSchool"  onclick="CheckRow(SchoolID=' + full.SchoolID + ',ClassID=' + full.ClassID + ',SectionID=' + full.SectionID + ')"></button>';
                    return val;
                }{
                    "mDataProp": "SchoolID",
                    "sWidth": "25%"
                },{
                    "mDataProp": "ClassID",
                    "sWidth": "25%"
                },{
                    "mDataProp": "SectionID",
                    "sWidth": "25%"
                },],
                "columnDefs": []
        });
    }

0 个答案:

没有答案