### File

`src/group/data-table.model.ts`

### Extends

`Group`

### Index

###### Properties
Public validations
###### Methods
Public getQuestionByName Public getQuestionByNameAndIndex Public isRequired

### Constructor

`constructor(code: string, description: string, questions: [][], validations: Validation[])`
Defined in src/group/data-table.model.ts:5
Parameters :
Name | Type | Optional | Description
code | `string` |  |
description | `string` |  |
questions | `[][]` |  |
validations | `Validation[]` |  |

### Methods

Public getQuestionByName
`getQuestionByName(name: string)`
Defined in src/group/data-table.model.ts:16
Parameters :
Name | Type | Optional | Description
name | `string` |  |
Returns : `Question<any>`

Public getQuestionByNameAndIndex
`getQuestionByNameAndIndex(name: string, index: number)`
Defined in src/group/data-table.model.ts:24
Parameters :
Name | Type | Optional | Description
name | `string` |  |
index | `number` |  |
Returns : `Question<any>`

Public isRequired
`isRequired()`
Defined in src/group/data-table.model.ts:38
Returns : `boolean`

### Properties

Public validations
`validations: `Validation[]``
Type : `Validation[]`
Defined in src/group/data-table.model.ts:11

    import { Group, GroupType } from '.';
    import { Question } from '../question';
    import { Pattern, Validation, ValidationType } from '../validation';

    export class DataTable extends Group<Question<any>[][]> {

      public constructor(
        code: string,
        description: string,
        questions: Question<any>[][],
        public validations: Validation[] = []
      ) {
        super(code, description, GroupType.DATATABLE, questions);
      }

      public getQuestionByName(name: string): Question<any> {
        for (const question of this.questions[0]) {
          if (question.name === name) {
            return question;
          }
        }
      }

      public getQuestionByNameAndIndex(name: string, index: number): Question<any> {
        const questions: Question<any>[] = this.questions[index];

        if (!questions) {
          return;
        }

        for (const question of questions) {
          if (question.name === name) {
            return question;
          }
        }
      }

      public isRequired(): boolean {
        for (const validation of this.validations) {
          if (ValidationType.REQUIRED === validation.type) {
            return true;
          }
        }

        return false;
      }
    }

# results matching ""

# No results matching ""