Cannot assign to read only property '_idx' of 0 when re-rendering data

Cannot assign to read only property '_idx' of 0 when re-rendering data

winworldwinworld Posts: 2Questions: 1Answers: 0

Hi everyone,

We have a dataset with dates we need to reformat, at first column. Table is loaded in the DOM via HTML.

We've tried with data-order attributes to maintain a right order in dates, but when we try to sort the column (but just for the first time) with the data-order attribute, we get this JS error in console (and no sorting is done):

"Cannot assign to read only property '_idx' of 0"

This doesn't happen when we sort by another different column, and then we try to sort by this column.

html code in one of our rows:

<tr>
<td data-order="1424773149">01/02/2015</td>
<td>example.com</td>
<td>10830</td>
<td>1234</td>
</tr>

Note: all rows in the table have the data-order attribute in the first <td>

Answers

  • winworldwinworld Posts: 2Questions: 1Answers: 0
    edited February 2015

    Sorry, can't edit the post, but I'd like to add that also we tried modifying column via 'render' and 'data' options, but that's for Ajax data sources, I think.

    I'd like to add, that the https://datatables.net/examples/advanced_init/html5-data-attributes.html example (from the docs) is not working (at all!!) as I think I should. Try to search the salary "320,800" without commas.

    Anyone can shed some light on this ? (Use another version? Known bug? Something we're doing wrong?)

    Note: I noticed a bug in data-order, as it should have the value 1422745200000. Anyway, the error

    "Cannot assign to read only property '_idx' of 0" still pops up when I try to sort this column for the very first time.

    Final EDIT [Solved] : when I cast dataTable, I had the option order: ['0', 'desc'] . Despite it does what it should, after removing it this error didn't trigger anymore... And THAT was the problem... it should be order: [0, 'desc'] (notice 0 as int, not as string)....

    Cheers

This discussion has been closed.