kartik-v / yii2-export

A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)
http://demos.krajee.com/export
Other
165 stars 126 forks source link

All rows being exported even with filtering on gridview when enablePushState is set to false on gridview. #352

Closed jmpangilinan closed 2 years ago

jmpangilinan commented 3 years ago

Prerequisites

Steps to reproduce the issue

  1. set enablePushState to false on gridview pjaxSettings
  2. export to csv,excel,html,pdf,text

Expected behavior and actual behavior

When I follow those steps, it exported all rows

I was expecting to export the filter rows on the grid view

Environment

Browsers

Operating System

Libraries

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/99952656-all-rows-being-exported-even-with-filtering-on-gridview-when-enablepushstate-is-set-to-false-on-gridview?utm_campaign=plugin&utm_content=tracker%2F7668315&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F7668315&utm_medium=issues&utm_source=github).
jmpangilinan commented 3 years ago

I have temporarily fixed this by modifying line 113 on kv-export-data.js

from:

frmConfig = $.extend(true, {}, cfg.formOptions, { action: window.location.href, target: cfg.target, method: 'post', css: {display: 'none'} });

to:

var $grid = $('#' + cfg.colSelId).parents('div[data-pjax-container]:first'); var filters = $.param($grid.find('tr.filters:first').find('[name]').serializeArray()); frmConfig = $.extend(true, {}, cfg.formOptions, { action: window.location.href.split(/[?#]/)[0] + '?' + filters, target: cfg.target, method: 'post', css: {display: 'none'} });

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.