Trang tài liệu Trí Nam

Chín người đàn bà không thể đẻ ra một đứa trẻ trong vòng một tháng

AutoCompleteControlSchema

Estimated reading: 3 minutes 191 views

Hình ảnh / Demo

Mục đích

Dùng để tạo 1 ô input tự động gợi ý dựa trên kết quả nhập trong form.

Cách dùng

Import

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

				
					import { AutoCompleteControlSchema } from 'tnx-shared';
				
			

Cách dùng cơ bản

AutoCompleteControlSchema được thêm vào trong this.setting.schema khi khởi tạo form.
				
					...
ngOnInit() {
...
this.setting.schema = [
      new AutoCompleteControlSchema({
        field: 'demoField',
        label: 'Demo',
        dataSource: TrangThaiWfDeXuatDataSource,
        mdWidth: 4
    }),
  ...
]
...
}
...
				
			

Tùy chỉnh cho phép chọn nhiều giá trị

				
					new AutoCompleteControlSchema({
    field: 'demoField',
    label: 'Demo',
    dataSource: TrangThaiWfDeXuatDataSource,
    multiple: true,
    mdWidth: 4
}),

				
			

Thêm thuộc tính multiple: true

Thuộc tính

Sự kiện

				
					
   new AutoCompleteControlSchema({
        field: 'demoField',
        label: 'Demo',
        dataSource: TrangThaiWfDeXuatDataSource,
        multiple: true,
        mdWidth: 4,
        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