...

View Full Version : How to load CSV, remove columns, dynamically populate menus & display filtered result



dframeli
03-18-2009, 01:53 PM
I have a new and seemingly huge new project to work on.

We have a database that our database administrator is willing to run a script on nightly. The result of this action will be a CVS file containing information that is specific to my departments needs.


At first, I need to present visitors to my site with a way to pear the data down to a more manageable size. Prior to displaying the CSV file contents, I thought I would display a set of column headers with checkboxes. Using the checkboxes, I'd like to give visitors to my site the ability to decide which columns of data they want to hide or display.

After they've made their selections and pressed an "OK" button, I'd like to display the remaining contents of the CSV file as a table in a seperate window.

The next part is very Excel like... At the top of each column, I'd like to include a series of drop down menus that visitors to my site can use to filter the list further.

In my case, I donít necessarily know every possible value for any given column. For example, imagine that one column contains city, another state and the third contains zip code. I could assume all 50 states in the union, however the actual data might also include Puerto Rico and the US Virgin islands. Or I might assume every zipcode in the US, however the actual data might include zip codes for Canada, etc... For this reason, I would like to populate the drop down menus dynamically.


Can anyone suggest a way for me to load the contents of the CSV file into a table, a sensible way for visitors to remove unneeded columns, a way to auto-populate the drop down menus used to filter the remaining table, and finally, an efficient way to filter and then display the remaining data?

If you have experience with something like this, or know of forum posting already dealing with these subjects, please feel free to point me in the right direction.

Thanks!

Philip M
03-18-2009, 02:21 PM
I have a new and seemingly huge new project to work on.

Can anyone suggest a way for me to load the contents of the CSV file into a table, a sensible way for visitors to remove unneeded columns, a way to auto-populate the drop down menus used to filter the remaining table, and finally, an efficient way to filter and then display the remaining data?

If you have experience with something like this, or know of forum posting already dealing with these subjects, please feel free to point me in the right direction.

Thanks!



The large scope of this enquiry suggests that you ought to post it in the Web Projects forum. This forum is intended to help people solve specific JavaScript problems - it is not a free coding service, especially for commercial projects.

Old Pedant
03-19-2009, 03:45 AM
Also, JavaScript ALONE is not the ideal way to solve this problem. You'd be much better off with a PHP or JSP or ASP "back end" doing a lot of the work.

dframeli
03-20-2009, 03:43 PM
I'm just a novice programmer, and this is not a commercial job.

Also, I don't have access to using anything on the server side. Basically, all I have access to is JS and jQuery, etc...

It is a big job, so I'll have to work on it piece by piece. If it runs a little slow, that's better than nothing :) Computers and the Internet connections are getting faster every day, so what runs a little slow today may not be so slow this time next year :)

I already found the code needed(?) to load my CSV file.

Is there an easier way for me to do it using just JS?

<script src="javascripts/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="javascripts/jquery.csv2table.js" type="text/javascript" charset="utf-8"></script>
<input
class = "btn1"
type = "button"
onclick = "$('#view50').csv2table('test.csv',{
sortable : false
});"
value="Run">
<div id="view50"></div>


So next, I guess I'll concentrate on getting my spreadsheet into an array.

Afterwards, I'll look at how I can filter the resulting table.

If anyone can suggest a better way, please feel free to let me know.

Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum