Checking data before applying filter

Checking data before applying filter

flarpyflarpy Posts: 47Questions: 0Answers: 0
edited February 2013 in General
Hi Allan

I am applying a filter in fnInitComplete as below:
this.fnFilter('<?php echo $this->escape($this->translate('live'), ENT_QUOTES);?>', findColumnNumber('status', settings.aoColumns));

This works fine, except in very rare circumstances where the dataset contains no items matching status 'live'. I would like to only apply the filter if the loaded data set contains 'live'. Please could you let me know the best way to achieve this.

Many thanks

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    You'd need to use the fnGetColumnData plug-in to get the data for the column and check to see if your value is in it before then applying the filter. A $.inArray() should do the business.

    Regards,
    Allan
  • flarpyflarpy Posts: 47Questions: 0Answers: 0
    Perfect, thanks
This discussion has been closed.