data-filter not working

2019-09-04 06:53发布

According to the DataTables Orthogonal Data manual page you can use data-search and data-filter HTML5 attributes to specify custom filtering terms to be used instead of the display data.

That doesn't seem to be the case. Though there is some specific behaviour in my app - I am using row.add() and passing it an unrendered HTMLTableRowElement.

I also tried implementing a columns.render function with very little success. The custom filtering data specified in it is not used by the .filter().

Below is the implementation as requested:

columnDefs: [
  {
    targets: '_all'
    render: ( data, type, row, meta ) =>
      if type == 'filter'
        return 'test'
      else
        return row[meta.col]
  }
]

My custom filter looks simply as this:

table.data().filter ( value, index, context ) ->
  console.log [value, index, context]
  return true

But I am only getting the original table values and no custom filtering attributes.

Any ideas about what could be improved?

0条回答
登录 后发表回答