Khái niệm

Web Block là một UI component có khả năng tái sử dụng
Encapsulates(Đóng gói) logic của chính nó

Creating Web Blocks

Có hai cách:

  • Drag and Drop
  • UI Flow context menu (Right click)

Designing and Using Web Blocks

Web Blocks được thiết kế giống như Screens (Cũng không có Output Parameters)
Web Blocks có thể chứa:
● Input Parameters
● Local Variables
● Preparation
● Screen Actions
Events
Placeholders

Placeholder Widget

Chỉ available (có sẵn) bên trong Web Blocks
Bảo lưu không gian cho dynamic content, được định nghĩa khi instantiated (Khởi tạo)

Dynamic Content in Web Blocks

Mỗi instance của Web Block có thể có nhiều content khác nhau inside the Placeholders

Using Web Blocks

Web Blocks có thể được đặt bên trong một Web Screen hoặc Web Block khác
Parent của Web Block là thành phần chứa nó
Recursion(Đệ qui) KHÔNG CHO PHÉP
Parents có thể có nhiều instances của một Web Block

Sự tương tác với Parent

Interaction with the Parent (Sự tương tác với Parent)
Web Blocks có:
scope riêng của nó
○ Không có quyền truy cập vào parent's scope
Events để tương tác

Tương tác với parent được thực hiện bằng cách sử dụng events:
Web Block triggers an event
Parent handles từ sự kiện của Web Block

Web Block Interactions

Events

Defining Events

Events chỉ có thể được định nghĩa trong scoped của Web Blocks
Events CÓ THỂInput Parameters để gửi data đến parent
Input parameters có thể BẮT BUỘC HOẶC KHÔNG

Triggering Events

Events CHỈ có thể triggered bên trong Web Block

Event Handlers

Screen Actions được định nghĩa trong scoped của parent
● Chỉ định logic cho một handle Event
Web Block Có quyền truy cập vào Event Input Parameters
Khi một Web Block triggers một Event:: Event handler Action sẽ được executed

Different Event Handlers

● Mỗi Handler có thể sử dụng different Screen Action
Same Screen Action có thể được sử dụng nhiều handlers

Screen Lifecycle with Web Blocks

Screen Lifecycle with Web Blocks

Web Blocks Events Lifecycle

Ajax Refreshing a Web Block


Để click vào Button của Block 2 nhưng có thể validation một Input nằm trong Block 1

HẾT.

@Copyright 2022 by HieuEM Github