Filter table by headers

30 views
Skip to first unread message

Josh B

unread,
Nov 28, 2019, 4:07:55 PM11/28/19
to web2py-users
Hi,

Does anyone know how to add filters to table headers (so that the user can filter a table using table data from each column)?

I'm struggling doing it with <select> and I've seen some ideal solutions in java but they don't seem to work for me (see below).

Any help greatly appreciated - v new to programming!
Thanks
Josh

my table views:
<table class="table", id=table1>
   
<tr>
       
<th>Assigned to</th>
       
<th>Type</th>
       
<th>Priority</th>
       
<th>Project</th>
       
<th>Task description</th>
       
<th>Attachments</th>
       
<th>Due Date</th>
   
</tr>

    {{for row in rows:}}
       
<tr>
           
<td><a href="{{=URL('edittasklist', args=row.tasklist.id)}}">{{=row.auth_user.FullName}}</a></td>
           
<td>{{=row.tasklist.jobtype}}</td>
           
<td>{{=row.tasklist.priority}}</td>
           
<td>{{=row.tasklist.projectid}}</td>
           
<td>{{=row.tasklist.heading}}</td>
           
<td>{{=row.tasklist.attachment}}</td>
           
<td>{{=row.tasklist.duedate}}</td>
       
</tr>
    {{pass}}
</table>

java:
  1. <script language="javascript" type="text/javascript">  
  2. //<![CDATA[  
  3.     var table1_Props =  {  
  4.                     col_0: "select",  
  5.                     on_change: false,  
  6.                     btn: true,  
  7.                     enter_key: false  
  8.                 }  
  9.     var tf4 = setFilterGrid( "table1",table4_Props );  
  10. //]]>  
  11. </script>  

Ruslan Gareev

unread,
Nov 29, 2019, 12:52:03 AM11/29/19
to web2py-users
Hi! Maybe using Datables will feet your request.

пятница, 29 ноября 2019 г., 2:07:55 UTC+5 пользователь Josh B написал:
Reply all
Reply to author
Forward
0 new messages