girder / girder_web_components

Reusable Javascript and VueJS components for interacting with a Girder server.
https://gwc.girder.org
Apache License 2.0
16 stars 9 forks source link

Feature: Iterate over items in a DataBrowser #104

Closed subdavis closed 4 years ago

subdavis commented 5 years ago

Spoke with @matthewma7 about this: He presented a good argument for a downstream wanting to access and know about the current data browser "view". He wants access to all the rows of items and folders in the current view without using the "selection" mechanism. This comes with a full understanding that the current view is not an accurate representation of a folder's contents and would not be used as such.

I can appreciate the flexibility that might afford, and I think it could be done in a clean way on the data browser side. But I'm having trouble coming up a use case where knowledge of rows feels appropriate.

In a case like Matthew's, where the desired feature is to iterate over the item(s) in a browser view, I think data browser could provide better support for that case, such as hooks for next() and previous() that change the currently selected row and cause the update:selected event to fire. This has the added benefit of upstream not having to care about pagination if there are more things on the next page.

Because this is unsupported, Matthew was forced to reach into DataBrowser's state and inspect the rows, and I'd like to provide him with a better alternative.

Options

matthewma7 commented 5 years ago

@subdavis Thank you for creating this issue to describe my need and track this feature.

The iteration hooks sound great since it would also handle pagination and stuff. Reaching the 'rows' does make the DataBrowser more open, though I think it would still be useful for some cases. Maybe we could make a shallow copy of the array to prevent handler modify the array to make it a little bit safer.

subdavis commented 4 years ago

This use case seems to have dried up, so I'm going to close the issue.