8

As we are aware that we can create Admin Grid to display list of item from database table with two ways:

1.Using layout

2.Using component

I want to know which one is best and what is difference between both approaches? Please share your thoughts.

asked May 4, 2018 at 12:09

1 Answer 1

8

UI Components:

+ It's mostly configuration. So you write less code.
+ you get a cool grid with show/hide columns,drag/drop columns, full text search, inline edit, export built in and maybe others.
+ It can easily be extended with just another XML file in a different module.
+ any new feature Magento rolls out for the grids you will get it automatically in your grid.
- Difficult to debug.
- Difficult to modify.
- Difficult to build non standard grids.
- Not very much control over what happens.

Layout:

+ You got full control of what happens.
+ Relatively easy to build non-standard grids.
+ Easy to debug
+ You can use your knowledge from M1 to do it.
- Grid is not that flexible or extensible.
- you need to write the same code over and over again.
- More code to test or that can break
answered May 4, 2018 at 13:25
1
  • 4
    One small note, the layout/block way is being deprecated in favor of the ui-component. See @deprecated 100.2.0 in favour of UI component implementation * @since 100.0.2 in the class. That might be a worthwhile negative for the layout version Commented May 30, 2018 at 11:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.