searchPanes.preSelect with rows, which contain only icons

searchPanes.preSelect with rows, which contain only icons

KompetenzfroschKompetenzfrosch Posts: 5Questions: 3Answers: 0
edited February 20 in Free community support

Hi,
I am using DataTables with Django and Bootstrap5.
In my table, I have some rows which contain only Bootstrap icons. However, I want to filter them and have a preselect.
I already added some hidden text, because otherwise the filter wouldn't work.
My row:

<td>{% bs_icon 'check-circle-fill' color='green' %}<div style="display:none;">Some Text.</div></td>

Unfortunately, the preSelect still does not work.
My Script:

<!-- Datatable -->
<script>
  $(document).ready(function() {
     $('#MyTable').DataTable( {
    fixedHeader: {
        header: true,
        footer: false
    },
        pagingType: 'full_numbers',
        order: [[0, 'asc']],
        select: false,
        buttons: [
            'copy', 'print', 'csv'
        ],
        searchPanes: {
            initCollapsed: true,
            clear: false,
            orderable: false,
            columns: [2, 7],
            preSelect: [
                {
                    column: 7,
                    rows: ['Some Text.']
                    }
                ]
        },
        dom:
            "<'row'<'col-sm-12 col-md-12'P>>" +
            "<'row'<'col-sm-12 col-md-6 mb-2'B><'col-sm-12 col-md-6 mb-2'f>>" +
            "<'row'<'col-sm-12 mb-2'tr>>" +
            "<'row'<'col-sm-12 col-md-4'p><'col-sm-12 col-md-4 text-center'i><'col-sm-12 col-md-4'l>",
      } );
  } );
</script>

What should I write for the preSelect to make this work?

Best regards,
Kompetenzfrosch

Sign In or Register to comment.