DT_RowID on version 1.10.10

DT_RowID on version 1.10.10

neonblueneonblue Posts: 4Questions: 2Answers: 0
edited February 2016 in DataTables 1.10

Looking at this: https://datatables.net/manual/server-side and this https://datatables.net/examples/server_side/object_data.html it shows that if you pass DT_RowId as a column that DataTables will automatically assign the id field to the DataTable. I'm passing that in and it's not showing up... Nor if I code hint does it show that "id" is a possible variable to select...

$('#newsFeed tbody').on('click', 'tr', function () {
    var nTr = this.parentNode.parentNode;
    var di1 = this.parentNode.id;
    var di2 = this.id;

DataTable:

    oTable = $('#newsFeed').DataTable({
    "bProcessing": true,
    "bServerSide": true,
    "bSearchable": false,
    "sAjaxSource": 'RSSList',
    "bJQueryUI": true,
    "aoColumns": [
                    //{
                    //    mDataProp: "DT_RowId", "bSortable": false, "bSearchable": false//, "visible": false
                    //},
                    {
                        mDataProp: "RSSName", "bSortable": false, "bSearchable": false
                    }
                 ]
});

JSON

{"aaData":[{"DT_RowId":0,"RSSName":"Most Recent"},{"DT_RowId":1,"RSSName":"My Website"}]}

Answers

  • neonblueneonblue Posts: 4Questions: 2Answers: 0

    It appears to have to be returned as type "string" for this to work... When I changed the data model for DT_RowId to string it started working with this.id.

  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin

    Interesting - it should be that any data type can be used - DataTables will just write it to the id attribute directly without any type conversion. I've put a little example together here: http://live.datatables.net/tosemixa/1/edit .

    It is possible that this is some kind of version issue - the example above uses the very latest code (which will match the behaviour of 1.10.11 in this regard).

    Allan

This discussion has been closed.