I have an HTML/XML table generated by AJAX that displays limited columns of a database table. I would like to filter rows of the HTML/XML table using columns from the database that aren't part of the HTML table.
Example:
MySQL tables (ignore bad syntax):
TABLE technicians (id,
name,
email,
level,
PRIMARY KEY (id));
TABLE certificates (id,
type,
name,
PRIMARY KEY(id, type),
FOREIGN KEY (id) REFERENCES technicians(id));
HTML/XML table:
<table>
<tr>
<td>technician name</td>
<td>technician level</td>
</tr>
</table>
Each row in the HTML/XML table will display the technician name and technician level, but each "technician row" will have more data associated with it in the database. I want to filter each "technician row" by certificates as well as level. Note that as an individual attribute is filtered the corresponding rows are shown/hidden, instead of submitting a block of criteria at once (each criteria submits itself, basically).
As far as I can tell, I can do this in the following ways:
- Track the additional data in the HTML/XML table. This way I can hide/show individual rows as their attributes are filtered.
- Reload the table by passing the filter criteria to my server side script. This would require me to parse the entire filter form and reload the whole table each time an attribute is filtered.
- Send an AJAX request of criteria to filter to a script that will return ID's of technicians in JSON format. That way I could store only the technician's ID with the table row.
I'm new to web development and I'm trying to find a good balance between doing things server side vs. client side. What is the proper way to accomplish this?
EDIT: added number 3.