http://qs321.pair.com?node_id=1041010


in reply to How to add the client filtering function in perl table?

Since you specifically said client filtering of a table, and since your table is HTML, I believe that what you're really looking for is a way for your Perl code to generate simple HTML based on your data set and having a person's web browser do the work of sorting, filtering, and possibly editing. With that in mind, I highly recommend that you use DataTables or similar. I've used DataTables, and there is much documentation on how to do pretty styling, but more to your point, there is a built in API for column filtering.

Current best practice for web applications is to NOT put inline attributes like fonts and colors, relying on CSS to do all styling. Furthermore, you should consider your Perl code as a data source for your tables, and use AJAX to have a web browser send requests using JavaScript and your Perl code return data, probably in a form like JSON for the JavaScript to interpret and display.

To get started quickly, what I would do is to take your code, get rid of the inline styling, just make a syntactically correct table, have your HTML page include DataTables, and use JavaScript to quickly get your sorting and filtering working.

  • Comment on Re: How to add the client filtering function in perl table?