/// <summary> /// 配置复选框单元格 /// </summary> private void ConfigCheckboxCell(TagBuilder builder) { var checkBoxBuilder = new CheckBoxBuilder(); checkBoxBuilder.AddAttribute("(click)", "$event.stopPropagation()"); checkBoxBuilder.AddAttribute("(change)", $"$event?{_tableId}.selection.toggle(row):null"); checkBoxBuilder.AddAttribute("[checked]", $"{_tableId}.selection.isSelected(row)"); var cellBuilder = new CellBuilder(); cellBuilder.AppendContent(checkBoxBuilder); builder.AppendContent(cellBuilder); }
/// <summary> /// 配置复选框列头 /// </summary> private void ConfigCheckboxHeader(TagBuilder builder) { var checkBoxBuilder = new CheckBoxBuilder(); checkBoxBuilder.AddAttribute("(change)", $"$event?{_tableId}.masterToggle():null"); checkBoxBuilder.AddAttribute("[disabled]", $"!{_tableId}.dataSource.data.length"); checkBoxBuilder.AddAttribute("[checked]", $"{_tableId}.isMasterChecked()"); checkBoxBuilder.AddAttribute("[indeterminate]", $"{_tableId}.isMasterIndeterminate()"); var headerCellBuilder = new HeaderCellBuilder(); headerCellBuilder.AppendContent(checkBoxBuilder); builder.AppendContent(headerCellBuilder); }