Trang tài liệu Trí Nam

Tài liệu hướng dẫn vận hành DevOps

RadioButtonListControlSchema

Estimated reading: 3 minutes 250 views

Hình ảnh / Demo

Mục đích

Dùng để tạo 1 danh sách các radio button và chỉ được chọn 1 giá trị

Cách dùng

Import

Import vào đầu file .ts cần sử dụng

				
					import { RadioButtonListControlSchema } from 'tnx-shared';
				
			

Cách dùng cơ bản

RadioButtonListControlSchema được thêm vào trong this.setting.schema khi khởi tạo form.

				
					...
ngOnInit() {
...
this.setting.schema = [
    new RadioButtonListControlSchema({
        field: 'datYeuCau',
        label: 'Kết quả',
        dataSource: [
            { id: true, ten: 'Chọn' },
            { id: false, ten: 'Không chọn' }
        ],
        mdWidth: 4,
        required: true
    }),
  ...
]
...
}
...
				
			

Thuộc tính

Sự kiện

				
					
  new RadioButtonListControlSchema({
      field: 'myField',
      label: 'Trường muốn dùng',
      onChanged: (eventData: EventData) => {
        console.log(eventData);
        if (this.model.data.property || <>) {
            evt.formControls['other control name'].hidden = true;
        } else {
        evt.formControls['other control name'].hidden = false;
        }
      },
      // nếu là thành viên ngoài trường thì hiện, không phải thì ẩn đi
      hiddenCheck: (rootModel, currentNode) => {
         return !currentNode.parentNode.parentModel.isThanhVienNgoaiTruong;
      },
  })
				
			
CONTENTS