⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

how to export selected rows



sachin vairagi
  • profile picture
  • Member

Posted 22 February 2013 - 12:36 PM

Hello

 

i want to export seleted rows in CSV, can anyone help me??

 

Thanks!


davidoster
  • profile picture
  • Member

Posted 22 February 2013 - 13:15 PM

Use the export button on the top right of grocery crud frame.


sachin vairagi
  • profile picture
  • Member

Posted 22 February 2013 - 18:52 PM

hello davidoster,

 

i want to export selected rows in CSV, for example i have users table containing 10 fields. I want to select 5 fields of my choice

in CSV.

 

Thanks !


davidoster
  • profile picture
  • Member

Posted 22 February 2013 - 19:54 PM

Ooooo sorry my mistake!

But tell me again do you want selected rows or selected fields?

 

Let's take the less easier case... selected fields.

The very easy way would be by using the columns function to limit the displayed fields and then use the export button.

But this would be valid (will change) the display of all records (rows) within the list.

If you want to export just a few fields spread around, e.g. 

row 1 -> userid, name

row 2 -> userid, lastname

row 3 -> userid, name,lastname,telephone

this is something that has to be done via :

1. javascript, to enable the selection of each field

2. php, to have a controller function to initiate the export process

3. javascript, an ajax call to return to php controller function the selected data

4. php, a function to export to CSV the formatted data

 

Now for selected rows.

You need to check for the theme you are using if there is some documentation.

a. https://groups.google.com/forum/?fromgroups=#!topic/flexigrid/h6s7ccQ5tQE

b. http://www.datatables.net/examples/api/select_single_row.html

c. http://www.datatables.net/release-datatables/extras/TableTools/select_multi.html

 

And then follow the directions as above from step 2 to step 4.


sachin vairagi
  • profile picture
  • Member

Posted 23 February 2013 - 05:05 AM

Thanks Davidoster, sorry it was my mistake i want to export selected coloumns. but anyways this really worked great !