Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 407201e

Browse filesBrowse files
committed
refactor: CDataTable: small refactors
- show default pagination only when there is more than one page - add aria-label attributes
1 parent e4d743d commit 407201e
Copy full SHA for 407201e

File tree

Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed

‎src/table/CDataTable.js

Copy file name to clipboardExpand all lines: src/table/CDataTable.js
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ const CDataTable = props => {
394394
onInput={(e)=>{tableFilterChange(e.target.value, 'input')}}
395395
onChange={(e)=>{tableFilterChange(e.target.value, 'change')}}
396396
value={tableFilterState || ''}
397+
aria-label="table filter input"
397398
/>
398399
</div>
399400
}
@@ -405,6 +406,7 @@ const CDataTable = props => {
405406
<select
406407
className="form-control"
407408
onChange={paginationChange}
409+
aria-label="changes number of visible items"
408410
>
409411
<option value="" disabled hidden>
410412
{perPageItems}
@@ -444,9 +446,10 @@ const CDataTable = props => {
444446
( fields && fields[index].filter !== false &&
445447
<input
446448
className="form-control form-control-sm"
447-
onInput={(e)=>{columnFilterEvent(colName, e.target.value, 'input')}}
448-
onChange={(e)=>{columnFilterEvent(colName, e.target.value, 'change')}}
449+
onInput={e=>{columnFilterEvent(colName, e.target.value, 'input')}}
450+
onChange={e=>{columnFilterEvent(colName, e.target.value, 'change')}}
449451
value={columnFilterState[colName] || ''}
452+
aria-label={`column name: '${colName}' filter input`}
450453
/>)
451454
}
452455
</th>
@@ -543,7 +546,7 @@ const CDataTable = props => {
543546
{ pagination &&
544547
<CPagination
545548
{...paginationProps}
546-
style={{display: totalPages > 0 ? 'inline' : 'none'}}
549+
style={{display: totalPages > 1 ? 'inline' : 'none'}}
547550
onActivePageChange={(page) => { setPage(page) }}
548551
pages={totalPages}
549552
activePage={page}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.