Reporting Solution in PHP / CodeIgniter - Server side logic vs client side

Posted by dot on Programmers See other posts from Programmers or by dot
Published on 2014-01-22T16:59:02Z Indexed on 2014/08/21 4:31 UTC
Read the original article Hit count: 249

I'm building a report for an end user. They would like to see a list of all widgets... but then also like to see widgets with missing attributes, like missing names, or missing size.

So i was thinking of creating one method that returns json data containing all widgets... and then using javascript to let them filter the data for missing data, instead of requerying the database.

Ultimately, they need to be able to save all "reports" (filtered versions of data) inside a csv file.

These are the two options I'm mulling over:

Design 1

Create 3 separate methods in my controller/model like:

get_all_data()
get_records_with_missing_names()
get_records_with_missing_size()

And then when these methods are called, I would display the data on screen and give them a button to save to csv file.

Design 2

Create one method called get_all_data() and then somehow, give them tools in the view to filter the json data using tables etc... and then letting them save subsets of the data.
The reality is, in order to display all data, I still need to massage the data, and therefore, I know which records are missing attributes. So i'd rather not create separate methods by each filter.

I'm not sure how I would do that just yet but at this point, i would like to know some pros/cons of each method.

Thanks.

© Programmers or respective owner

Related posts about php

Related posts about codeigniter