私は仕事のためにいくつかの助けが必要です。物語は次のようになります:AG-Grid:サーバーからの応答に基づいて編集可能な列を作成
Item-Id!== nullの場合、「Date」列を編集可能にする必要があります。
私たちには、AG-Gridで作成された受信ボックスがある「ビュー」があります。 受信トレイのようになります:取得中...
public columnDefs = [
{title: Item-Id, editable: this.editable()},
{title: Date, editable: this.editable()},
{title: Justification, editable: this.editable()}
];
いくつかのコードを
を:あなたは、オブジェクトを持っているAG-グリッドの列ヘッダを生成するには
---| 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 |---
----------------------------------------
方法私はこのようなものを持っています:
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...}]
}
私は非常にあなたの助けに感謝します。
p.s:列["editable"] = trueなどのメソッドを使用してセルを編集可能にすることはできません。それは動作しません。 trueまたはfalseを返す関数である必要があります。
私はあなたがしたいことはとても簡単だと思いますが、あなたのコードサンプルはちょっと混乱しています... – thirtydot