torf

Setting Fields for tabular data

Recommended Posts

As I am completely new to processWire I stumbled upon a question which may be easy to solve, but I don't see how it is possible:

Among other things I'd need the possibility to add fields for tabular Data where the columns are predefined but the rows are free to add or edit. For an example we have a couple of companies who  present data on pages. So they all produce the same products but in different amounts per month and different colours. As an Admin I'd like to define the products, but leave it to the backend-user to fill in their colours as needed.
As those the given values are needed in a filter or search afterwards they have to be in fields as far as I understood the concept.

Is there a possibility to set up fields that give an output like shown in the attached images?

companyA.JPG

companyB.JPG

Share this post


Link to post
Share on other sites
Posted (edited)

Welcome @torf!

Profields Table would be ideal, but RepeaterPageTable and Page Reference (with modal editing via AsmSelect) are also candidates, or even a custom repeating fieldtype in the style of the demo Events module.

Oh, and one more: child pages together with Batch Child Editor.

And another: pages from anywhere (not just children) with inline editing via Lister Pro.

So many options... 🙂

Edited by Robin S
Add more options.

Share this post


Link to post
Share on other sites

Does each company edit their products themselves? i.e. does each company have an admin-access?

That would make the whole process / setup a bit more complicated. You would have to make sure that each company-admin only has the necessary rights to edit their own colours.

It would all still be doable with PW - it would just need a bit more planning, and thinking ahead of the whole structure/architecture.

Share this post


Link to post
Share on other sites

Wow. That is in fact a lot of possibilities...
I've already seen ProFields and thought it should do the job, but as I am still in evaluation I cannot buy a plugin for testing purposes. But I'll have a look at the others.

As for the editing: I thought of giving them their own editing rights, but at the moment this will not be mandatory. Maybe not for my first project 😉

Thanks for your help.

Share this post


Link to post
Share on other sites

I'll leave this here as well. Might not be a good for product variants, but generally it should be evaulated to use pages before moving stuff into a single page: 

 

Share this post


Link to post
Share on other sites

there is FieldtypeHandsontable which is exactly what you displayed, it lets you have an excel-like input field. Very cool and useful thanks to @bernhard

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi @torf, welcome to the forum 🙂 

17 hours ago, Macrura said:

there is FieldtypeHandsontable which is exactly what you displayed, it lets you have an excel-like input field. Very cool and useful thanks to @bernhard

thx @Macrura, indeed it looks like my fieldtype could be helpful here, but it has some limitations!

On 7/15/2018 at 9:19 AM, torf said:

As those the given values are needed in a filter or search afterwards they have to be in fields as far as I understood the concept.

This could already be one of the limitations. The data is stored as JSON in a textarea, so searching could be from easy (if you only search for fulltext) to nearly impossible (if you want to filter for specific products and properties.

Another limitation (possible problem) of the fieldtype is that it is very inflexible when you want to change the rows/columns. Imagine You setup a field with columns Product A, B, C and you want to add column A2 between A and B - that would mess up all existing data or you would need to write a script to update all occurences.

So, it could be an option, but you could also have a look at this other option that might be a better fit: 

 

Share this post


Link to post
Share on other sites

Thanks for all of your help!

Handsontable looked very promising (and was easy to set up) . The Filter and search options are what made me question the module, but as from MySQL 5.7 JSON should be searchable that drawback could maybe be bypassed.

Matrix was on my list already, but I could not get it to work, as it needs a bit more understanding of processwire concepts for setup. It looks perfect but is clearly not a beginners module. But I really should give it another try...

  • Like 1

Share this post


Link to post
Share on other sites

To post a conclusion if someone runs into the same requirements:

At last I used repeater fields for the table. The Backend input may not be as nice as with Handsontable or Matrix Fieldtypes, but in this case it suited best, as it uses fields and is highly configurable at the frontend.

With Handsontable data is stored in a JSON which makes it quite difficult to change columns if there is already data in the fields ans also the frontend JS messed up the processwire CSS somehow.
Matrix Fieldest on the other hand did not give me an opportunity (or at least I could not find it) to add rows on a page basis. In my example the colours are defined by the companies and every company has there own very special colourset. Therefore I cannot predefine them.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.