Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2008
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts

    How to load CSV, remove columns, dynamically populate menus & display filtered result

    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!

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,082
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by dframeli View Post
    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.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,232
    Thanks
    80
    Thanked 4,456 Times in 4,421 Posts
    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.

  • #4
    New Coder
    Join Date
    Dec 2008
    Posts
    18
    Thanks
    4
    Thanked 0 Times in 0 Posts
    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!
    Last edited by dframeli; 03-20-2009 at 02:48 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •