Trang tài liệu Trí Nam

Cho người ta một phần mềm, bạn sẽ làm họ bực mình một ngày - Dạy người ta lập trình, họ sẽ bực mình cả đời

TextAreaControlSchema

Estimated reading: 3 minutes 459 views

Hình ảnh / Demo

Mục đích

Dùng để tạo 1 ô input nhập văn bản nhiều dòng trong form.

Cách dùng

Import

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

				
					import { TextAreaControlSchema } from 'tnx-shared';
				
			

Cách dùng cơ bản

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

				
					...
ngOnInit() {
...
this.setting.schema = [
    new TextAreaControlSchema({
        label: '2. Tên nhiệm vụ',
        fullLabel: 'Tên nhiệm vụ',
        field: 'ten',
        mdWidth: 12,
    }),
  ...
]
...
}
...
				
			

Tùy chỉnh số dòng mặc định

				
					
            new TextAreaControlSchema({
                label: '2. Tên nhiệm vụ',
                fullLabel: 'Tên nhiệm vụ',
                field: 'ten',
                mdWidth: 12,
                rows: 20,
            }),
				
			

Khi hiển thị trên giao diện, số dòng mặc định sẽ là 20 dòng thông qua thuộc tính rows

Thuộc tính

Sự kiện

				
					
  new TextAreaControlSchema({
      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 field này đi
      hiddenCheck: (rootModel, currentNode) => {
         return !currentNode.parentNode.parentModel.isThanhVienNgoaiTruong;
      },
  })
				
			
CONTENTS