Skip to content

Column Filters not working with table composed of colspan cells containing HTML elements #843

@AustinFrederick

Description

@AustinFrederick

Hello! I am trying to use this in my project. I have a somewhat complex HTML table that contains 25 columns. The first 13 columns contain strings. The last 12 columns contain HTML elements (divs) which represent the timing of various activities in a project.

The last 12 columns are composed of a 12 column colspan in each row, which house these divs (screenshot below for clarification). I am able to get the table filter to work on a basic grid, but when I apply it to this grid then the column filters dont work. All other features seem to work however.

My table is built dynamically on page load, including all html elements. After the table is built I use this code to initialize the filters.

const tf = new TableFilter('meqGantt', {
        base_path: 'static/tablefilter/',
        filters_col_index: 1,
        paging: true,
        state: { types: ['cookie'] },
        alternate_rows: true,
        rows_counter: true,
        btn_reset: {
            text: 'Clear'
        },
        status_bar: true,
        col_1: 'select',
        col_2: 'select',

        /* columns visibility and sort extension */
        extensions: [{
            name: 'sort'
        }]
    });
tf.init();

Note that that code isnt fully set up as I was just trying to get at least one or two columns filterable. I have tried many different variations of that chunk of code and nothing worked for me so far.

Here is the skeleton of my table before it gets loaded with data
`

                            <thead style="background: #f5f5f5;border-radius: 5px !important;border: 1px solid #cecece; ">
                            <tr style="font-weight: 600; text-align: center">
                                <th class="id">Project Number</th>
                                <th class="projectNumber">Project Number</th>
                                <th class="projectName">Project Name</th>
                                <th class="location">City-State-Country</th>
                                <th class="projectExecutive">Project Executive</th>
                                <th class="projectManager">Project Manager</th>
                                <th class="planner">Planner</th>
                                <th class="coordinator">Coordinator</th>
                                <th class="bim">BIM</th>
                                <th class="procurement">Procurement</th>
                                <th class="logistics">Logistics</th>
                                <th class="services">Services</th>
                                <th class="status">Status</th>
                                <th class="dateCellOne date" style="border-left: 1px solid black !important;" >Date 1</th>
                                <th class="dateCellTwo date" >Date 2</th>
                                <th class="dateCellThree date" >Date 3</th>
                                <th class="dateCellFour date" >Date 4</th>
                                <th class="dateCellFive date" >Date 5</th>
                                <th class="dateCellSix date" >Date 6</th>
                                <th class="dateCellSeven date" >Date 7</th>
                                <th class="dateCellEight date" >Date 8</th>
                                <th class="dateCellNine date" >Date 9</th>
                                <th class="dateCellTen date" >Date 10</th>
                                <th class="dateCellEleven date" >Date 11</th>
                                <th class="dateCellTwelve date" >Date 12</th>
                            </tr>
                            </thead>
                            <tbody>

                            </tbody>
                        </table>`

And here is a screenshot of what I am seeing so that you can understand how this table gets used. All data fed to the table is a String unless its under one of the date columns. You can see the area it creates in the header for the filters, but nothing shows up.

image

Is the TableFilter compatible with what I am trying to do or do I need to create me own filtering system?

Thanks!

For usage and support questions, please check out resources below, you might find an answer:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions