Cannot edit cell using editor #1204
-
Hi, I'm trying to enable cell editing following the documentation but it does not work. When I click on a cell, nothing happen.
<angular-slickgrid gridId="grid1"
[columnDefinitions]="columnDefinitions"
[gridOptions]="gridOptions"
[dataset]="dataset"
(onAngularGridCreated)="angularGridReady($event.detail)">
</angular-slickgrid>
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { AngularGridInstance, Column, Editors, FieldType, GridOption, Observable } from 'angular-slickgrid';
@Component({
selector: 'app-myslickgrid',
templateUrl: './myslickgrid.component.html'
})
export class MySlickgridComponent implements OnInit {
columnDefinitions: Column[];
gridOptions: GridOption;
dataset: any[];
angularGrid: AngularGridInstance;
constructor(private http: HttpClient) { }
angularGridReady(grid: AngularGridInstance) {
this.angularGrid = grid;
}
prepareGrid() {
this.columnDefinitions = [
{
id: 'name',
name: 'Name',
field: 'name',
minWidth: 100,
type: FieldType.string,
editor: {
model: Editors.longText
}
},
{
id: 'code',
name: 'Code',
field: 'code',
type: FieldType.string,
editor: {
model: Editors.text
}
}
];
this.gridOptions = {
enableCellNavigation: true,
};
}
ngOnInit(): void {
this.prepareGrid();
this.loadData();
}
getRequest(): Observable<string[]> {
return this.http.get<string[]>('assets/countries.json');
}
loadData(): void {
this.getRequest().subscribe(((data: any[]) => {
this.processData(data);
}) as any);
}
processData(data: any[]) {
data.forEach((item, index) => {
item.id = index;
});
this.dataset = data;
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
ghiscoding
Jul 19, 2023
Replies: 1 comment 2 replies
-
See Example 3, read the Editors Wiki or ask your question on Stack Overflow. In your case, it looks like you missed |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ghiscoding
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See Example 3, read the Editors Wiki or ask your question on Stack Overflow. In your case, it looks like you missed
editable: true
grid option.