cheetah-grid icon indicating copy to clipboard operation
cheetah-grid copied to clipboard

Using CSV data instead of JSON

Open mspanish opened this issue 4 years ago • 1 comments

It seems like parsing to JSON is sort of a costly unnecessary step for data that is already in CSV format - do you have any way to accommodate for that style of data? Where the fields for the columns would be laid out like:

let fields = ["id", "name", "screen_name", "location", "description", "url", "protected", "followers_count", "friends_count", "listed_count", "created_at", "favourites_count","verified", "statuses_count", "profile_background_image_url_https", "profile_image_url_https" ]

And the values would come in arrays from streaming chunks of CSV. Right now I convert them but it seems like there must be a better way :)

mspanish avatar Jul 10 '20 03:07 mspanish

Does that mean the records are in an array? If so, field can be a function that gets the value from the record. You may be able to use this.

   {
     // ...
     field: record => record[0], // id
     // ...
   },
   {
     // ...
     field: record => record[1], // name
     // ...
   }

ota-meshi avatar Jul 16 '20 04:07 ota-meshi