1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-11-29 11:24:10 +01:00
DataTables/.datatables-commit-sync
Allan Jardine fb6a7be880 Fix: Selector errors when using jQuery selectors with dt-init deferRender enabled
Fix: Incorrect returns from sub-methods if a selector does not contain any results (DataTables/DataTables #431)
Update: `dt-api iterator()` has a fourth parameter to indicate that a return value is expected

The basic issue here was the `iterator()`'s automatic check to see if a
new API instance should be returned or not. If there are no results from
a selector the iterator will just use the original API instance to
return, but this isn't correct as we expect an empty result set in this
case. This is partly due to the fact that the top level methods (`row()`
for example) will return 2D arrays, while the child methods will flatten
the results, this is parhaps an error in the API, but too late to fix
now.

To address this, `iterator()` now has a parameter to tell it if a new
instance should be used or not. I debated about a new method
`iteratorNew()`, but I think this is just as clear (which isn't very
clear unfortunatly, but just needs to be made clear in the
documentation, which I've updated for this change).

I've added tests for the selectors with `deferRender` enabled. The test
suite is still in desperate need of update...
2014-11-03 15:18:18 +00:00

2 lines
41 B
Plaintext

8013a8e9e0726d0c31dc141c75b41602c9446f42