8664

Yii - Get all data of filtered CGridView

Question:

I got a question about the CGridView in Yii. The case is that I want to export the current filtered data of all pages within a CGridView to an excel sheet. Now the problem is that I am getting the id's of each row within the gridview with jQuery. This means that only the rows that are currently visible on the page of a pagination are sent to the excel generator and not the ones that are at another pages.

My question is, is there a way within Yii to get all the data from all paginated pages from a CGridView in some kind of object?

Thanks in advance.

Answer1:

You can use the the $.fn.yiiGridView.getSelection(containerID) to retrieve the key values of the selected rows in jQuery. And then you can post your results and retrieve the exported file for downloading.

Recommend

  • EntityDataSource query inner join
  • gridview rendered in div
  • Binding a list with another list with WPF
  • yii2 sorting in related model
  • Fixed Background Works in Chrome but Not Firefox?
  • Creating UDF with VSTO in Excel
  • Accessing another variable in the same class with a click event
  • Responsive Form on top of Responsive Image? - Bootstrap
  • VBA Dir function not working on Excel 2010
  • Why can't UI components be accessed from a backgroundworker?
  • Outlook to Excel hyperlink issue
  • How to open html table in xls on click of a button
  • C# Excel interop - how to test if interop object is still working and performing a task?
  • How to getText() from the input field of an angularjs Application
  • CakePHP 2.0.4 - findBy magic methods with conditions
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Join two tables and save into third-sql
  • vba code to select only visible cells in specific column except heading
  • How to model a transition system with SPIN
  • When should I choose bucket sort over other sorting algorithms?
  • ORA-29908: missing primary invocation for ancillary operator
  • How do you troubleshoot character encoding problems?
  • jQuery tmpl and DataLink beta
  • Do I've to free mysql result after storing it?
  • Unanticipated behavior
  • Transpose CSV data with awk (pivot transformation)
  • Data Validation Drop Down Box Arrow Disappearing
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How to disable jQuery.jplayer autoplay?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • Understanding cpu registers
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • How to stop GridView from loading again when I press back button?
  • Can't mass-assign protected attributes when import data from csv file
  • Sorting a 2D array using the second column C++
  • Unable to use reactive element in my shiny app
  • Converting MP3 duration time