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

Fallback properties in TableColumn (and elsewhere ?) #230

Open
calummackervoy opened this issue Jan 20, 2021 · 2 comments
Open

Fallback properties in TableColumn (and elsewhere ?) #230

calummackervoy opened this issue Jan 20, 2021 · 2 comments
Assignees

Comments

@calummackervoy
Copy link

Feature suggestion

At times there are multiple properties which data could include for the same information, e.g. VCARD.FN and FOAF.name for my name column

Expected functionality/enhancement

It would be great if I could define some fallback settings in the props of the TableComponent which allows me to say "try this list of priorities to display the name"

Actual functionality/enhancement

I believe that I'm bound by one property option -> one column per table. If I want to display different options, I need to use multiple tables with duplicate data or couple my code to the datasets I want to use

Use Cases

I want to write my Table to display a list of objects which have names, but I want to support common name definitions so that it can be flexible to the choices of data providers

There is also a case where a particular ontology may have multiple versions, for example http://www.w3.org/2006/vcard/ns#fn and http://www.w3.org/2001/vcard-rdf/3.0#FN, and currently the one is not displayed with the other. The dream scenario would be if the TableComponent could be permissive between different versions of the same ontology, but I see that there would be many complexities in implementing this or even hacking around it

There will be similar use cases in other components, I haven't suggested a generalised solution here because I lack the knowledge

Additional information

I started coding in React a few weeks ago using the Inrupt SDK so my experience in the framework is extremely limited, I'd be happy to attempt a PR for this but I might need help. It's also for a hobby project and my paid work naturally eats up my time, so I might be a bit slow

@ajacksified
Copy link
Contributor

ajacksified commented Jan 26, 2021

Hi @calummackervoy,

We're working through a couple of different edge cases with the table display, but for now you can work around it by using a custom body component for the TableColumn. Each "body" component is wrapped in a Dataset and Thing provider, so you can use a Text, Value, or other component - each of which do implement a fallback array, and allow them to just pull the dataset/thing from context:

<Table things={[...]}>
  <TableColumn
      property="http://www.w3.org/2006/vcard/ns#fn"
      body={() => (
        <Text properties=["http://www.w3.org/2006/vcard/ns#fn", "http://www.w3.org/2001/vcard-rdf/3.0#FN"] />
      )}
  />
</Table>

We do plan on implementing this in Table at some point - I'll leave this issue open until then, but this workaround should help out.

(Also a ping for @VirginiaBalseiro who I was just talking to about this.)

@calummackervoy
Copy link
Author

Thanks !

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

2 participants