Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Dataset From Powergrid #52

Open
wvitpr opened this issue May 31, 2020 · 7 comments
Open

Getting Dataset From Powergrid #52

wvitpr opened this issue May 31, 2020 · 7 comments

Comments

@wvitpr
Copy link

wvitpr commented May 31, 2020

Hi,
Is there a way to get the displayed Dataset from a powergrid, it would save running the query again to use the data somewhere else..
Something like..
elements.mypowergrid.getDataset..

@wvitpr
Copy link
Author

wvitpr commented Jun 3, 2020

I guess its like getSelectedRow() but get all rows.. It would be very handy for exporting into svyExcel module..

@paronne
Copy link
Member

paronne commented Jun 3, 2020

Hi,

the PowerGrid has already a feature to export data in various formats using the API elements.mypowergrid.exportData(...); would that work for you already ?
There is any other applicable use case where is useful to retrieve the Dataset from the PowerGrid component ?
Note the PowerGrid is populated via Dataset in first place, therefore you can always cache the original Dataset from your first query.

Kind regards,
Paolo

@wvitpr
Copy link
Author

wvitpr commented Jun 3, 2020

Hi Paolo,
Thanks for the reply, I'm used the native export function at the moment , its great but I would like to change to the svy module for the flexibilty of formatting columns etc. And yes, I could run the query again and retreive data that way, but in most cases the data behind the grid has more columns that are show on the grid, so requires further processing to get a duplication of what is on the grid. So I thought if possible to just retreive the data displayed on the powergrid would be a handy feature.

@gboros
Copy link
Collaborator

gboros commented Jun 26, 2020

hi,
When you set the dataset to the grid, the component parses it, and fills the data from it in its internal model, so it does not hold
a reference to the dataset. But all the data the grid shows, is the data from the dataset passed, so why not just use that instead of query the component to data, that in the end would be the same as the argument dataset, right?

@wvitpr
Copy link
Author

wvitpr commented Jun 26, 2020 via email

@seanthomasdevlin
Copy link
Member

I don't think we can/should do this. A dataset is just a static array of rows. It is incompatible with what could be in power grid, groups, aggregates, pivoting, etc. This use case is very narrow.

What specific options from svyExcelUtils do you need ?

@seanthomasdevlin
Copy link
Member

Another approach could be to cache the original dataset, then call getColumnState from the grid. You can parse and apply the filter, sort, columns order/visibility to the dataset

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants