bbgunmaster / jquery-csv

Automatically exported from code.google.com/p/jquery-csv
MIT License
0 stars 0 forks source link

[IMPROVEMENT] Add option to skip certain columns (eg. identified by index) #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use the plugin ((i.e. by doing `jQuery.csv.toArrays(myReallyLargeCsvData)`)

What is the expected output? What do you see instead?
i really would need an option like `ignore: [3,4,5]` to ignore columns 4 to 6 
in my file, for instance. Currently Scenario is: 

a. the plugin crunches through all data in the csv, giving back a huge object
b. then i let it loop through the data again, doing some really slow 
array.splice() functions on every row to get rid of the superfluous data, thus 
freeing the memory.

So each way, the browsers suffers from performance or memory decrease whenever 
there is data in the csv that it should ignore/throw away.

What version of the product are you using? On what operating system?
0.71 / Linux, Mac, Win

Original issue reported on code.google.com by p...@patient-radio.de on 20 Mar 2013 at 11:08

GoogleCodeExporter commented 9 years ago
That functionality already exists.

That's what user defined callbacks are for.

Basically, you attach a function to the onParseEntry hook that checks the 
column number and skips the ones you specify. Check the column number through 
the state.colNum parameter. You can skip an entry by returning false.

Give the documentation for Hooks a read:
https://code.google.com/p/jquery-csv/wiki/Hooks

Original comment by evanpla...@gmail.com on 20 Mar 2013 at 11:13

GoogleCodeExporter commented 9 years ago
Hey guys,

thanx so much for the answer, in my current work rush i just did a 
browser search on the lengthy overview page for "callback", browsed the 
options and methods and bottom, even went to the API page for the 
toArray Method, but obviously failed to scroll up and read the whole 
text before opening the ticket. Sorry for that and a big tip of hat for 
this excellent library!

Cheers - Phil

------------------------------------------------
change  I.T. - Software Development & Consulting
Norderstr. 97                    24939 Flensburg
MOBILE 0176-50128772    SKYPE philipp.austermann
https://www.xing.com/profile/Philipp_Austermann2
------------------------------------------------
  Bankverbindung GLS Bank              UST-IdNr.
  KTO          2019504400            DE266182829
  BLZ            43060967

Original comment by p...@patient-radio.de on 21 Mar 2013 at 6:07

GoogleCodeExporter commented 9 years ago
Your welcome.

I changed the front page to say hook/callback and added another wiki link to 
the documentation. 

Don't fret about opening a ticket, that's what it's there for. Without your 
feedback I wouldn't have known that changes should be made to make the 
documentation easier to find. The quality of this project is a direct result of 
a lot of good feedback from users.

Thanks for the contribution and for the appreciation.

Original comment by evanpla...@gmail.com on 21 Mar 2013 at 8:29