Cannot get the row id into the row with server side processing

Cannot get the row id into the row with server side processing

tamarmottamarmot Posts: 14Questions: 3Answers: 0

I am having trouble with my datatables editor now that I am using server side processing to build my data.
I am using the nifty django-datatables-view, and the data draws beautifully in my page.
Unfortunately, despite the fact that I am now passing back a 'DT_RowId' as a string (I have tried as an integer), and even though I am setting rowId: 'DT_RowId', there is no id on each row.

In my editor, I have idSrc: 'DT_RowId', as well.

I have certainly followed your suggestions ...
https://datatables.net/reference/option/rowId

The rows I am getting back now are pure data, not dictionaries, as the columns are all defined at the table level.

thanks so much
Tamar

Answers

  • tamarmottamarmot Posts: 14Questions: 3Answers: 0

    Further, I have tried defining a function for rowId:

    rowId: function(a) {
          return a[a.length-1];
    },
    

    This function returns the correct value for the id of the row, but even so I get the 'unable to find row identifier' exception.

    Thanks
    Tamar

  • tamarmottamarmot Posts: 14Questions: 3Answers: 0
    edited June 2016

    Ah. I have found that I just have to pass in the numeric index of the data which holds the id of the row, in my case 20.
    idSrc: 20,
    For the editor.
    So that part is now working and my inline editors are opening; my next issue is that they are not exiting ... Hope this helps anyone else who is using django-datatables-view and the editor.

This discussion has been closed.