KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

DataTable with hidden column causes the display of table to flash/re-render - not nice #3299

Open Roger Mangraviti opened this topic on on May 23 - 1 comments

Roger Mangraviti commented on May 23

We have a DataTable with first column being hidden/visible=false, this causes the rendering to appear to flash.

The issue we are seeing is that the DataTable renders with all columns displayed and then re-renders with the first column removed, this causes a type of flash/table adjustment which is a visual issue.

Apart from hiding the DataTable with a setTimeout and then display, is there another way to deal with this rendering issue ?

Sebastian Morales commented on May 24

Yours is quite an interesting question. Using either DataTables' column's hidden property or column css classname to set display: none does indeed show flashing of the hidden column. Fortunately when we set css rule directly to the column elements (th, td) like following the effect could be avoided:

    DataTables::create(array(
        ...
        "columns" => array(
            ...
            "extension"
        ),
        'cssStyle'=>array(
            'th' => function($colName) {
                if ($colName === 'extension') return "display: none";
                else return "";
            },
            'td' => function($row, $colName) {
                if ($colName === 'extension') return "display: none";
                else return "";
            },
        ),

Hope this is what you wanted.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None