Skip to content

Commit 5eecf28

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored andcommitted
Improve DataGrid boolean cell handling.
Allow boolean cells to be recognized as true if their text content is "true", in addition to having a `data-value` attribute, and ensure boolean cells have a `part` attribute. Bug: 443727194 Change-Id: I1f079a45cc94fe056e275744573c527f0c3e9bba Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6948391 Reviewed-by: Philip Pfaffe <[email protected]> Auto-Submit: Danil Somsikov <[email protected]> Commit-Queue: Danil Somsikov <[email protected]>
1 parent 62e1652 commit 5eecf28

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

front_end/ui/legacy/components/data_grid/DataGridElement.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ class DataGridElementNode extends SortableDataGridNode<DataGridElementNode> {
399399
const cell = cells[i];
400400
const column = this.#dataGridElement.columns[i];
401401
if (column.dataType === DataType.BOOLEAN) {
402-
this.data[column.id] = hasBooleanAttribute(cell, 'data-value');
402+
this.data[column.id] = hasBooleanAttribute(cell, 'data-value') || cell.textContent === 'true';
403403
} else {
404404
this.data[column.id] = cell.dataset.value ?? cell.textContent ?? '';
405405
}
@@ -472,7 +472,9 @@ class DataGridElementNode extends SortableDataGridNode<DataGridElementNode> {
472472
override createCell(columnId: string): HTMLElement {
473473
const index = this.#dataGridElement.columns.findIndex(({id}) => id === columnId);
474474
if (this.#dataGridElement.columns[index].dataType === DataType.BOOLEAN) {
475-
return super.createCell(columnId);
475+
const cell = super.createCell(columnId);
476+
cell.setAttribute('part', `${columnId}-column`);
477+
return cell;
476478
}
477479
const cell = this.createTD(columnId);
478480
cell.setAttribute('part', `${columnId}-column`);

0 commit comments

Comments
 (0)