I need some help for work. The story goes like this:
I need to make the "Date" Column editable if Item-Id !== null;
We have a "view" where we have an inbox created with AG-Grid. The inbox looks like this:
---| Item-Id | Date | Justification |---
----------------------------------------
---| |24.05 | text |---
----------------------------------------
---| 31 |25.05 | text 2 |---
----------------------------------------
---| 31 |25.05 | text 2 |---
----------------------------------------
---| |24.05 | text |---
----------------------------------------
---| |24.05 | text |---
----------------------------------------
---| 31 |25.05 | text 2 |---
----------------------------------------
To generate the column headers in AG-grid you have an object:
public columnDefs = [
{title: Item-Id, editable: this.editable()},
{title: Date, editable: this.editable()},
{title: Justification, editable: this.editable()}
];
...some code...
in the Get method I have something like this:
http.get(data).subscribe(response(
{
...some code...
this.editableColumns(response);
}));
public editableColumns(item: any) {
//this method need to return true or false;
console.log(response); // [{itemId: null, date: "24.05", justification: "text"},{itemId: 31, date: "24.05", justification: "text"},...etc...}]
}
I would very much appreciate your help.
p.s: you cannot make the cells editable by using methods like column["editable"] = true; It won't work. It needs to be a function that returns true or false.