Open alexdryden opened 9 months ago
Makes sense to me — the existing list vis already adds columns conditionally based on the sorting that's applied to the lens, and once the refactoring in this pr has been merged, it will be even easier to add behavior like this (I think it could be done by default, without any additional UI, as long as there are some sizing checks, which are also already partially in place). I don't have the bandwidth to tackle this myself, but if you're interested in working on it I can give some pointers once we merge the pr above.
Yeah, I’d be happy to work on it and would really appreciate any pointers. Thanks!
On Fri, Feb 16, 2024 at 11:15 AM Erik Loyer @.***> wrote:
Makes sense to me — the existing list vis already adds columns conditionally based on the sorting that's applied to the lens, and once the refactoring in this pr https://github.com/anvc/scalar/pull/229 has been merged, it will be even easier to add behavior like this (I think it could be done by default, without any additional UI, as long as there are some sizing checks, which are also already partially in place). I don't have the bandwidth to tackle this myself, but if you're interested in working on it I can give some pointers once we merge the pr above.
— Reply to this email directly, view it on GitHub https://github.com/anvc/scalar/issues/230#issuecomment-1948776055, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALHR2NRZ4GDAH5QBJ57SSVDYT6A2VAVCNFSM6AAAAABDKZONC6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNBYG43TMMBVGU . You are receiving this because you authored the thread.Message ID: @.***>
OK, now that the PR has been merged, here are some thoughts — this will be a little sketchy but hopefully helpful. You'll be working in scalarvisualizations.jquery.js
. There's a method called getColumns
that helps figure out what columns to display. Specifically, lines 4799-4804 add additional columns depending on whether the source lens includes sorts or not. Basically, you'll want to do something similar based on what metadata fields the lens references.
The difference is that while there are a finite number of conditional columns which a sort can cause to appear, there are an arbitrary number of metadata properties that can be added based on whatever the lens is referencing. You'll want to do some logging of the lens and node objects (the content returned by the lens) to understand how they're structured, but for any given node, node.current.properties
will get you its complete list of properties. The addColumnToRowForNode method handles the actual adding of content to the results table, it will need to be modified to handle the arbitrary metadata.
Hopefully this is enough to get you started; let me know if you have questions.
Great! Thanks for the tips!
This is based on some feedback I received from a group on the UIUC campus who uses Scalar and was echoed by an author who is publishing a book using Scalar with the Illinois Open Publishing Network. I noticed some recent work on column display handling for lenses, so I thought this might be a ripe time to suggest this feature.
Issue:
When users build a lens with metadata facets for a list view, they would like the to see the metadata they are querying as a results column.
Example:
A user wants to see all pages that are within 50 miles of the center of Berlin that do not contain the word "Berlin" in the iptc:city field. They are interested in the query primarily to see which cities are represented, however, that data isn't returned and displayed in the list.
Roadblocks/Risks:
Managing how many columns are represented in the results
Implementation ideas:
There could be a checkbox as part of the configuration interface that would indicate if this field should be included in the results, something like this:
Alternatively, a more complete solution might add an additional drop down when the list is selected that allows users to select which columns to display for this lens: