DynamicTableSource constructor

DynamicTableSource({
  1. bool showActions = false,
  2. bool showDeleteAction = true,
  3. required List<DynamicTableDataRow> data,
  4. required List<DynamicTableDataColumn> columns,
  5. required String actionColumnTitle,
  6. bool onRowEdit(
    1. int index,
    2. List row
    )?,
  7. bool onRowDelete(
    1. int index,
    2. List row
    )?,
  8. List? onRowSave(
    1. int index,
    2. List oldValue,
    3. List newValue
    )?,
})

Implementation

DynamicTableSource({
  this.showActions = false,
  this.showDeleteAction = true,
  required this.data,
  required this.columns,
  required this.actionColumnTitle,
  this.onRowEdit,
  this.onRowDelete,
  this.onRowSave,
}) {
  _selectedCount = data.where((element) => element.selected).length;
  for (int i = 0; i < columns.length; i++) {
    if (columns[i].dynamicTableInputType.dependentOn != null) {
      int dependent = (columns[i].dynamicTableInputType
              as DynamicTableDependentDropDownInput)
          .dependentOn!;
      if (dependentOn[dependent] == null) {
        dependentOn[dependent] = [];
      }
      dependentOn[dependent]!.add(i);
    }
  }
}