_aFilterData being null?

_aFilterData being null?

daniel_rdaniel_r Posts: 460Questions: 4Answers: 67

Hi,

I can't figure out why in the following test case the _aFilterData is null? You can see in the console of the browser that the following line: col_inner_elements = data[j]._aFilterData[column_number_filter]; throws an error and I can't figure why? isn't the ._aFilterData should contain the rendered output of the cell?
While in the other test case every thinkg works as expected - ._aFilterData does hold the rendered value

p.s
I'm the author of the yadcf plugin

Thanks ahead

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin

    Hi Daniel,

    That internal property will be null if the data for that row has either been invalidated, or not yet requested for that data type.

    This is how DataTables gets the filtered data internally.

    It sounds like your code is attempting to get the data before DataTables has done its own filtering (and thus resolved any invalidated rows).

    Allan

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    edited May 2016

    Thanks,

    I've added 10 seconds delay (see updated test case) but still the result is the same, its null, Any ideas on how to solve it? because the two test cases looks the same more/less, but still in the first test case the _aFilterData is null?

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin
    Answer ✓

    Yup - sorry. I should have spotted this earlier. You have:

    "searching": false,

    So DataTables doesn't do any filtering, and doesn't bother to populate the filtering information since it doesn't do any filtering!

    You need to have that option enabled. Use dom if you don't want the default filtering input (which your example already has).

    Allan

  • daniel_rdaniel_r Posts: 460Questions: 4Answers: 67
    edited May 2016

    Ohhhh.....

    How could I miss that one :|

    Thanks @allan !

  • allanallan Posts: 61,920Questions: 1Answers: 10,153 Site admin

    Same way I did. We look at too much code :-)

This discussion has been closed.