1

One of the columns in my table.datatable is the name of the enterprise that are registered on my db. I wrapped the name of each enterprise with an 'a' tag for a quick option to edit the enterprise profile, but the issue is that the filters are also filtering the url.

Example: I want to filter for "DPVNice" the client and owner of the system. But the first enterprise, which is "Advertising", and its url is "http://localhost/dpvnice/admin/empresa/4/editar". I tried changing the name of the folder in localhost and it solves this problem, but i can't change the name on production that has DPVNice on it.

Bottomline, is there a way to bypass filtering anything with the 'a' tag?

pcezar91
  • 111
  • 11
  • I used a hidden column without the URL and filter on that column to bypass my problem, but this makes the table do render slower – pcezar91 Apr 27 '15 at 15:16

1 Answers1

1

You can use data-search attribute on <td> element to specify value used for filtering. Below is an excerpt from the manual:

DataTables will automatically detect the following attributes on HTML cells:

data-sort or data-order - for ordering data

data-filter or data-search - for search data

Example:

<tr>    
    <td data-search="Tiger Nixon">T. Nixon</td>    
    <td>System Architect</td>    
    <td>Edinburgh</td>    
    <td>61</td>    
    <td data-order="1303682400">Mon 25th Apr 11</td>    
    <td data-order="3120">$3,120/m</td>
</tr>

See manual or example for more information on data- attributes.

Alternatively you can use render method, detect filtering event (type == 'filter') and return desired value instead. See my answer to similar question for an example.

Community
  • 1
  • 1
Gyrocode.com
  • 57,606
  • 14
  • 150
  • 185