Skip to content

IgrGrid bodyTemplate is not displayed properly on cell/row edit when values come from other cells #116

@RivaIvanova

Description

@RivaIvanova

Description

If the bodyTemplate uses the cell.value inside the template to determine what content to render when the cell.value is updated on edit, the template is updated too.

<IgrColumn
  field="active"
  dataType="boolean"
  bodyTemplate={cellValueBodyTemplate}
></IgrColumn>

const cellValueBodyTemplate = (ctx: IgrCellTemplateContext) => {
  const value = ctx.cell.value;
  return (
    <>
      {value && (
        <img src="https://www.infragistics.com/angular-demos-lob/assets/images/grid/active.png" />
      )}
      {!value && (
        <img src="https://www.infragistics.com/angular-demos-lob/assets/images/grid/expired.png" />
      )}
    </>
  );
};

But if the value of another cell is used to determine what content to be rendered, the template is not updated when the other cell's value is changed on edit.

const rowDataBodyTemplate = (ctx: IgrCellTemplateContext) => {
  const value = ctx.cell.row.data.active;
  return (
    <>
      {value && (
        <img src="https://www.infragistics.com/angular-demos-lob/assets/images/grid/active.png" />
      )}
      {!value && (
        <img src="https://www.infragistics.com/angular-demos-lob/assets/images/grid/expired.png"  />
      )}
    </>
  );
};

<IgrColumn
  field="warehouseId"
  dataType="number"
  bodyTemplate={rowDataBodyTemplate}
></IgrColumn>
<IgrColumn
  field="active"
  dataType="boolean"
></IgrColumn>

IgrGrid - column bodyTemplate.zip

Maybe related to #115

Steps to reproduce

  1. Run the attached sample.
  2. Change any value in the "active" column.

Result

The template for the "active" column cell is updated, but the one for the "warehouseId" remains the same, even though its content depends on the value of the "active" column cell.

Expected result

Both templates should update similarly to the Angular grid.

Attachments

React Grid:

Image

Angular Grid:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions