File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 118118 "END_OF_DATA" : " You've reached the end of your content" ,
119119 "SCROLL_TOP" : " Scroll to top" ,
120120 "CHECKBOX_HEADER" : " Select all rows" ,
121- "CHECKBOX_ROW" : " Select row " ,
121+ "CHECKBOX_ROW" : " Select {{value}} " ,
122122 "EXPAND_BUTTON" : " Expand row" ,
123123 "SORT_DESCENDING" : " Sort rows by this header in descending order" ,
124- "SORT_ASCENDING" : " Sort rows by this header in ascending order"
125-
124+ "SORT_ASCENDING" : " Sort rows by this header in ascending order" ,
125+ "ROW" : " row "
126126 },
127127 "TABLE_TOOLBAR" : {
128128 "ACTION_BAR" : " Table Action Bar"
Original file line number Diff line number Diff line change @@ -347,7 +347,7 @@ import { I18n } from "./../i18n/i18n.module";
347347 (click)="setCheckboxIndex()">
348348 <ibm-checkbox
349349 inline="true"
350- [attr. aria-label]="checkboxRowLabel | async"
350+ [aria-label]="checkboxRowLabel | i18nReplace:getSelectionLabelValue(row) | async"
351351 [size]="size !== ('lg' ? 'sm' : 'md')"
352352 [(ngModel)]="model.rowsSelected[i]"
353353 (change)="onRowCheckboxChange(i)">
@@ -650,6 +650,18 @@ export class Table implements AfterViewInit {
650650 */
651651 @Input ( ) footerTemplate : TemplateRef < any > ;
652652
653+ /**
654+ * Used to populate the row selection checkbox label with a useful value if set.
655+ *
656+ * Example:
657+ * ```
658+ * <ibm-table [selectionLabelColumn]="0"></ibm-table>
659+ * <!-- results in aria-label="Select first column value"
660+ * (where "first column value" is the value of the first column in the row -->
661+ * ```
662+ */
663+ @Input ( ) selectionLabelColumn : number ;
664+
653665 /**
654666 * Emits an index of the column that wants to be sorted.
655667 *
@@ -952,4 +964,11 @@ export class Table implements AfterViewInit {
952964 setExpandIndex ( event ) {
953965 this . columnIndex = 0 ;
954966 }
967+
968+ getSelectionLabelValue ( row : TableItem [ ] ) {
969+ if ( ! this . selectionLabelColumn ) {
970+ return { value : this . i18n . get ( ) . TABLE . ROW } ;
971+ }
972+ return { value : row [ this . selectionLabelColumn ] . data } ;
973+ }
955974}
You can’t perform that action at this time.
0 commit comments