ColumnFilter "select" bug

ColumnFilter "select" bug

hozthozt Posts: 45Questions: 0Answers: 0
edited March 2012 in Plug-ins
Hello,

This plug-in obviously would save me lots of work, I figure it has some bug due to what's happening, I've been going around this for a couple of days now, and can't seem to find a reason.

What i have is ajax-source loading and I'm using aoColumns with mDataProp to say what goes where.

Then I just load columnFilter, worked fine, 'till i went and decided I wanted a 'select' field.
It doesn't fill the select, and pops this error:

"sValue is undefined"
At line 77 of the plug-in:
"if (bIgnoreEmpty == true && sValue.length == 0) continue;"

Any ideas and help would be very much appreciated! If Mr. Allan himself sorts me out, I'll donate another couple of beers.

The Plug-in: http://jquery-datatables-column-filter.googlecode.com/svn/trunk/ajaxSource.html
The test-case: http://andrecatita.com/databug/tarifarios.htm

Replies

  • hozthozt Posts: 45Questions: 0Answers: 0
    edited March 2012
    I figure someone who was a bit of experience can figure this out.
    I'm just hitting a wall.

    What i found is that, if I don't use sAjaxSource but copy my previously loaded into the table with he results. And just initialize datatable with columnfilter, it will appear then the select's.

    But, on the plug-in page it seems to be working with sAjaxSource, but not on my case.

    Did another test:
    when my aaData is filled with 'associative' arrays that I bind with mDataProp (it pops that error)
    Example:
    [code]
    "aaData": [
    {
    "DT_RowId": "1",
    "nome": "zzzzz",
    "data": "0000-00-00"
    }
    ][/code]
    When it is like this:
    [code]
    "aaData": [
    [
    "1",
    "zzzzz",
    "0000-00-00"
    ]
    ]
    [/code]
    It works!! But i need it like the first case.

    So it's either mDataProp or being an associative array that's the problem. Can't seem to figure it out from looking into the plug-in, would appreciate anyone who could tho.
  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    The problem is with the column filtering plug-in which is used the fnGetColumnData plug-in to get the data for the columns - the specific issue is that that plug-in hasn't been updated to cope with the mDataProp options that you are using.

    What to do is to replace these two lines in the plug-in:

    [code]
    var aData = this.fnGetData(iRow);
    var sValue = aData[iColumn];
    [/code]

    with:

    [code]
    var sValue = this.fnGetData(iRow, iColumn);
    [/code]

    and that should do it.

    I've updated the plug-in on the plug-ins page, and I'll open an issue against the column filtering plug-in.

    Allan
  • hozthozt Posts: 45Questions: 0Answers: 0
    Thank you!!

    Little fix on your code: this has to be oTable

    [code]var sValue = oTable.fnGetData(iRow, iColumn);[/code]

    Your awesome, period.
  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    Oops - thanks for that fix. I forgot that the column data function wasn't put in as an API method in the column filter plug-in.

    Good to hear that does the job for you.

    Allan
This discussion has been closed.