Search code examples
angulartypescriptng2-smart-tablengx-adminnebular

Obtaining the value column key inside a cell renderer?


Is it possible to obtain the column key inside a cell renderer?

For example in the `CustomRenderComponent Demo the value of the cell and the row data is injected like this:

@Input() value: string | number;
@Input() rowData: any;

is there a way to get the current column key? Something like:

@input column: string;

or get a Cell instance?

The Cell class has method like this:

getColumn(): Column {
  return this.column;
}

Smart Table Issue

https://github.com/akveo/ng2-smart-table/issues/518


Solution

  • Look at custom-view.component.ts. It has a method getPatch() that returns a ViewCell. Change this method to return a Cell.

    Now the custom renderer implementation will be patched with the entire Cell instance, rather than a few of the components belonging to it.

    Create a new interface that this type of renderer should implement, rather than just having it implement the ViewCell interface.