Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
935
How do I programmatically update values during rowEditing?
posted

I am using Angular 11 and current Ignite UI.

I have a grid which has columns users can edit (name, active, type, etc.) and other columns which they cannot (parameters changed in other screens, audit columns, etc.).

I want to know how to programmatically modify the "updated by" and "updated date" columns when rowEditing is finished (updates in the grid since it will automatically update in the back-end via persisting other column changes to the DB).

I don't know if it makes more sense to use a custom template for those columns or by using the (rowEditDone) process to somehow persist the expected data to those audit columns.

Parents
No Data
Reply
  • 640
    Verified Answer
    Offline posted

    Hello Chris,

    Thank you for posting in our community.

    What I can suggest for achieving your requirement is handling the rowEditDone event and then to manually change values of the UpdatedBy and UpdatedDate properties of the current row object:

    public rowEditDoneHandler(args: IGridEditDoneEventArgs) {

          const currRowIndex = this.data.indexOf(args.rowData);

          this.data[currRowIndex].UpdatedBy = this.username || 'Anonymous';

          this.data[currRowIndex].UpdatedDate = new Date();

          this.data = [...this.data];
    }

    I created a small sample illustrating my suggestion, which can be found here. Please test it on your side and let me know whether you find it helpful.

    Please let me know if you need any further assistance.

    Regards,

    Viktor Kombov

    Entry Level Software Developer

    Infragistics, Inc.

Children