|
6 | 6 | */ |
7 | 7 |
|
8 | 8 | import DataTable from 'datatables.net-bs5'; |
| 9 | +import 'datatables.net-buttons-bs5'; |
| 10 | +import DateTime from 'datatables.net-datetime'; |
| 11 | +import 'datatables.net-searchbuilder-bs5'; |
9 | 12 | import DOMPurify from 'dompurify'; |
10 | 13 | import '../images/svg/filter-square.svg'; |
11 | 14 |
|
@@ -1469,6 +1472,28 @@ var lizAttributeTable = function() { |
1469 | 1472 | } |
1470 | 1473 | }); |
1471 | 1474 |
|
| 1475 | + // Add searchBuilder button |
| 1476 | + // Disable live search to avoid searching on each keystroke |
| 1477 | + // Only display columns that are sortable for search |
| 1478 | + const searchBuilderButton = new DataTable.Buttons(oTable, { |
| 1479 | + buttons: [ |
| 1480 | + { |
| 1481 | + extend: 'searchBuilder', |
| 1482 | + config: { |
| 1483 | + liveSearch: false, |
| 1484 | + columns: '.dt-orderable-asc' |
| 1485 | + } |
| 1486 | + } |
| 1487 | + ] |
| 1488 | + }); |
| 1489 | + |
| 1490 | + // Attach searchBuilder button to attribute-layer-action-bar |
| 1491 | + const actionBar = document.querySelector(aTable) |
| 1492 | + .closest('.attribute-layer-content') |
| 1493 | + .previousElementSibling; |
| 1494 | + |
| 1495 | + actionBar.insertAdjacentElement('afterbegin', searchBuilderButton.container()[0]); |
| 1496 | + |
1472 | 1497 | // Unbind previous events on page |
1473 | 1498 | oTable.on( 'page', function() { |
1474 | 1499 | // unbind previous events |
@@ -1521,7 +1546,7 @@ var lizAttributeTable = function() { |
1521 | 1546 | data: "lizSelected", |
1522 | 1547 | width: "25px", |
1523 | 1548 | searchable: false, |
1524 | | - sortable: true, |
| 1549 | + sortable: false, |
1525 | 1550 | visible: false |
1526 | 1551 | }); |
1527 | 1552 | firstDisplayedColIndex+=1; |
|
0 commit comments