• arakchievilya

    (@arakchievilya)


    Hi all,

    I’m trying to make a block like a table. Can to see it in link https://drive.google.com/file/d/1NzzbhNF_gw2Cgz75l5aCCH5b8LDnAh85/view?usp=drive_link

    When I click the button (circle with a cross) another line with fields appears at the bottom. And when I click in the circle with horizontal line (button “delete”) another line is removed.

    I’ve been looking in Component’s list of WP, but I can’t to find.

    1. What wrapper I need to envolve this table?
    2. What wrapper I need to envolve each raw?
    3. What component I need to make a “button”?

    Thank you in advance

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator threadi

    (@threadi)

    First, I would ask what the purpose of this list is. Is it a kind of order form where you can manually enter the desired products and then send it via form? Or is it more like a shop?

    Depending on the answer, the implementation process could be completely different. It also depends on the theme you are using.

    Thread Starter arakchievilya

    (@arakchievilya)

    @threadi Thanks for your reply,

    This table is for product and block is for cooking blog. So I put in, e.g.:

    • Potato 500 g

    First field (product name) – Potato

    Second field (quantity) – 500

    Units – g

    • Oil 200 ml

    I have to add other product and I press button “Add” (circle with cross)

    First field (product name) – Oil

    Second field (quantity) – 200

    Units – ml

    And so on…

    Then I memorize this table like array with objects:

    [

    {“product”: “potato”, “quantity”: “500”, “unit”: “g”},

    {“product”: “oil”, “quantity”: “200”, “unit”: “ml”}

    ]

    Thread Starter arakchievilya

    (@arakchievilya)

    I think to do it that:

    Product – TextControl component;

    Quantity – TextControl component, but I need to convert it to number with Number() function or “+”

    Units – TextControl, ok

    But, how do I group it in row? What component I need to use?

    Moderator threadi

    (@threadi)

    Am I correct in understanding that you want to develop the block for this list yourself and are looking for suitable Gutenberg components? Because you posted your question in the “Fixing WordPress” forum, which is more about user questions than developer questions.

    For developer questions, there is https://ww.wp.xz.cn/support/forum/wp-advanced/ or, more likely, https://wordpress.stackexchange.com.

    The solution to your question would actually be the Group Block. However, I haven’t found any indication of which Gutenberg component can be used for this. Or maybe I overlooked it in the documentation: https://developer.ww.wp.xz.cn/block-editor/reference-guides/components/

    You could also check with the Gutenberg team to see if you can find any information there. Or ask your question there: https://github.com/WordPress/gutenberg/issues

    Thread Starter arakchievilya

    (@arakchievilya)

    Ups, sorry. I didn’t see the topic. Can it move to “Developing with WordPress Forum”?

    Thread Starter arakchievilya

    (@arakchievilya)

    @threadi Thank you for your replies. Stack is good platform

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Make table in Editor side’ is closed to new replies.