getRowModel method

TableRowModel? getRowModel(
  1. int index
)

Implementation

TableRowModel? getRowModel(int index) {
  // model exists?
  if (rows.containsKey(index)) return rows[index];

  // prototype exists?
  if (prototype == null) return null;

  // get data
  var data =
      (index >= 0 && this.data is Data && index < (this.data as Data).length)
          ? this.data[index]
          : null;
  if (data == null) return null;

  // build the row model
  TableRowModel? model = TableRowModel.fromXml(this, prototype, data: data);

  // register a listener to dirty field
  if (model?.dirtyObservable != null) {
    model?.dirtyObservable!.registerListener(onDirtyListener);
  }

  // add it to the list of rows
  if (model != null) {
    rows[index] = model;
  }

  return model;
}