Servoy / aggridcomponents

Advanced table components based on ag-Grid
MIT License
5 stars 10 forks source link

Getting Dataset From Powergrid #52

Open wvitpr opened 4 years ago

wvitpr commented 4 years ago

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 commented 4 years ago

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

paronne commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

Hi, I think I was trying to replicate what the old datasetGrid plugin did. It was really useful to just retrieve the data displayed including sorting.

Powergrid includes so many available options for the user to customise, floating filters, hiding columns etc , it would be nice to just capture the data as they see it without having to retrieve all the column options and build a query to replicate it.

On Fri., 26 Jun. 2020, 7:21 pm Gabi, notifications@github.com wrote:

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?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Servoy/aggridcomponents/issues/52#issuecomment-650081284, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUP7VXEKB5GSGLU74OR6DRYRSCPANCNFSM4NPEZKLA .

seanthomasdevlin commented 4 years ago

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 commented 4 years ago

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