Bug in API/fnUpdate documentation

Bug in API/fnUpdate documentation

motmot Posts: 5Questions: 0Answers: 0
edited April 2010 in Bug reports
Docs at http://datatables.net/api (and in the source code) say that '# bool (optional) : Redraw the table after inserting the table (optional - default true)'.

But default is false because source code (version 1.6.2) is (line #1686)
[code]if ( typeof bRedraw != 'undefined' && bRedraw )[/code]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Hi mot,

    Very good catch - that you for letting me know about that! The bug is in the code - fnUpdate certainly should redraw the table... The '&&' should really be an '||'...

    This will be corrected in the next release of DataTables.

    Regards,
    Allan
  • motmot Posts: 5Questions: 0Answers: 0
    edited April 2010
    Allan,

    Then I think code should be like this:
    [code]if ( typeof bRedraw == 'undefined' || bRedraw )[/code]
    or even better
    [code]if (bRedraw !== false)[/code]
    So it will not redraw the table only if bRedraw is false.
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yup - exactly right. Sorry about that - being daft in the early morning :-)

    Thanks for the pick up on that!

    Regards,
    Allan
  • kkudikkudi Posts: 77Questions: 0Answers: 0
    I know this is an old post, but I just don't get the difference of the boolean value.

    I mean if bDraw is false, the table is not redrawn.

    If bDraw is true, the table is redrawn.

    What does redraw mean in this case?

    if I do fnUpdate(....,,..., false)

    does that mean my changes will not be reflected?

    thanks
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Unfortunately there was a bug in 1.6.x which caused the redraw parameter to be ignored and the table as always redrawn... This has now been fixed in the 1.7 betas, although if you want a fix for 1.6.x then it is discussed in the posts above.

    The redraw will have DataTables update itself for the new data - so it would be displayed in the table (if appropriate), sorting, and filtering would act on it (if needed) etc. You would want to not redraw if you have a lot of updates to make, and then only redraw once.

    Allan
  • kkudikkudi Posts: 77Questions: 0Answers: 0
    Sorry to keep on asking qs but what's the effect of fbBuildSearchArray? When dealing with loads of fnUpdates it seems to be extremely slow.what will not work if it's commented out?
  • kkudikkudi Posts: 77Questions: 0Answers: 0
    Commented out within fnUpdate or fnAddData That is
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    The build search array function will do just that - it takes the data array (which is 2D) and constructs a 1D array, which can be used for searching. It is possible that this rebuild of the search array should only be done when the draw is allowed - although fnDraw doesn't actually do this - so you would need to use the internal functions to do that before drawing the table after a lot of updates... I'm put it on my to-do list to consider this interaction, it's probably not as trivial as it first appears.

    Allan
  • kkudikkudi Posts: 77Questions: 0Answers: 0
    when you say the build search array function "will do just that" what do u mean?

    When you say "it can be used for searching" what do you mean?

    Has it got anything to do with filtering or sorting data?

    I am sorry but im a bit confused about it.
  • kkudikkudi Posts: 77Questions: 0Answers: 0
    I'd greatly appreciate if you could answer just this question.

    thanks ;)
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Yes, when I say searching, I mean filtering (sorry - I tend to use the two words interchangably for DataTables....). So fnBuildSearchArray will build the search (filtering) array, to take account of your new data for searching. This is not done in an optimal manner at the moment - noted and added to the list of things to do, hopefully for the 1.7.0 release.

    Regards,
    Allan
This discussion has been closed.