mazdik / ng-mazdik

Angular UI component library
https://mazdik.github.io/ng-mazdik
MIT License
89 stars 34 forks source link

How to edit the cell #1

Closed winpzs closed 6 years ago

winpzs commented 6 years ago

for example:

this.table.editCell(rowIndex, cellIndex)
mazdik commented 6 years ago

Move focus to this cell and switch it to the editable mode?

import {CellEventArgs} from '../../ng-data-table/types';
this.table.events.onDblClickCell(<CellEventArgs>{columnIndex: 2, rowIndex: 0});

Or update the value of the cell?

this.table.rows[0]['name'] = 'new value';
this.table.events.onRowsChanged();
winpzs commented 6 years ago

for example:

  editRow() {
    let rowIndex = 0;
    let editMode = true;
    for (let columnIndex = 1; columnIndex < 6; columnIndex++)
      this.table.cellEditMode(rowIndex, columnIndex, editMode);
  }

or

  editRow() {
    let rowIndex = 0;
    let editing = true;
    for (let columnIndex = 1; columnIndex < 6; columnIndex++)
      this.table.cell(rowIndex, columnIndex).editing = editing;
  }
mazdik commented 6 years ago

Added function: editCell(rowIndex: number, columnIndex: number, editMode: boolean) how use

  public settings: Settings = {
    editMode: 'editProgrammatically'
  };

  editRow() {
    let rowIndex = 0;
    let editMode = true;
    for (let columnIndex = 1; columnIndex < 6; columnIndex++)
      this.table.editCell(rowIndex, columnIndex, editMode);
  }

https://github.com/mazdik/ng-crud-table/commit/c066ca65357396a2f3ccbe4b91888d7ce6a768ca

winpzs commented 6 years ago

thanks