data-filter not working

99封情书 提交于 2019-12-25 04:38:35

问题


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?

来源:https://stackoverflow.com/questions/40066590/data-filter-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!