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

Create a TableField (OSOE-583) #133

Open
sarahelsaig opened this issue Mar 5, 2023 · 7 comments
Open

Create a TableField (OSOE-583) #133

sarahelsaig opened this issue Mar 5, 2023 · 7 comments
Labels
enhancement New feature or request

Comments

@sarahelsaig
Copy link
Member

sarahelsaig commented Mar 5, 2023

It would be nice to have a field for storing admin-editable static tabular data.

  • The content field settings would let you set the column count, column names (maybe even the types?)
  • The editor would use <icbin-datatable> so rows can be added and the content set.
  • It could have separate display types for either responsive Bootstrap table or DataTables table.

Jira issue

@github-actions github-actions bot changed the title Create a TableField Create a TableField (OSOE-583) Mar 5, 2023
@Piedone
Copy link
Member

Piedone commented Mar 5, 2023

Can you provide some example use-cases?

@Piedone Piedone added the enhancement New feature or request label Mar 5, 2023
@sarahelsaig
Copy link
Member Author

@Piedone
Copy link
Member

Piedone commented Mar 5, 2023

Please elaborate here so it's publicly available.

@sarahelsaig
Copy link
Member Author

The scenario is that we have an OrchardCore.Commerce webshop and we want to add a line item to the cart that represents shipping cost. Instead of some extremely specific implementation that would be hard to customize later, I want to add a workflow trigger for when the shopping cart is loaded. This way the admin can write a JS script to insert the new line item or do any other manipulation on the cart. In the workflow you'd use the Retrieve Content task to load in the content item with the table part and use its data in the script. At the same time you could display the same content item on the site for the end user's information and it won't ever be out of date because you display the same content that the workflow logic uses

@Piedone
Copy link
Member

Piedone commented Mar 5, 2023

Doesn't this need an extension of the OCC cart instead of a generic table?

Also, any other scenarios where this would be useful?

@sarahelsaig
Copy link
Member Author

Doesn't this need an extension of the OCC cart instead of a generic table?

Nope, the data would be consumed by a workflow triggered by the cart, but it wouldn't belong to the cart. I deliberately don't want us to implement a specific shipping data model in the OCC cart, because the model structure and the calculation logic varies from business to business. For example we were asked about additional shipping costs based on postal code, but in the past I had to address the same feautre in a project where it was based on country code instead of postal code:
image
Technically you could store this data in the workflow, for example as a JS object array. But that sounds very unpleasant, error prone, and not good for maintenance.

Also, any other scenarios where this would be useful?

Back when I implemented the site setting editor for the locally maintained tax rates feature feature in OCC, I wouldn't have had to write a custom Vue-based editor if this existed.

So to sum it up in general terms:

  • Displaying static tables in content items without the need to write HTML or JS.
  • Store tabular data that can be consumed in workflows.
  • A reusable table editor with a consistent look for any future features that need one.

@Piedone
Copy link
Member

Piedone commented Mar 6, 2023

Interesting, OK, thanks.

Just to add, we should have the table responsive, of course.

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

No branches or pull requests

2 participants