KoolReport's Forum

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

"dom" => 'Bfrtip' mask "Show X entries" in the DataTables #1922

Closed Ammirati opened this topic on on Feb 24, 2021 - 4 comments

Ammirati commented on Feb 24, 2021

I have a problem in the DataTables, when I put in the option : "dom" => 'Bfrtip' The result is the text "Show X entries" disapears.

If I remove the option, the text "Show X entries" is shown and I can select 10, 25... in the list.

Do you know how to have the buttons and the text "Show X entries" ?

My code is :

DataTables::create(array(

"dataSource"=>$this->dataStore("indicatorTable"),
"colorScheme"=>"more",
"plugins"=>array("Buttons", "FixedColumns", "FixedHeader", "KeyTable", "Responsive", "RowReorder", "Scroller", "SearchPanes"),
"columns"=>array(
    "code"=>array(
        "label"=>"Code",
        "type"=>"string",
    ),
    "description"=>array(
        "label"=>"Description",
        "type"=>"string",
        'data-order' => 'description', //order this column by description
        'data-search' => 'code', //search this column by description
    ),
),
"options" => array(
    "dom" => 'Bfrtip',
    "buttons" => [
        array(
            'extend'=>'excel',
            'text'=>'<i class="fas fa-file-excel"></i> Excel',
            'titleAttr'=>'Excel',
            'className'=>'btn btn-sm btn-primary ml-2'
        ),
        array(
            'extend'=>'print',
            'text'=>'<i class="fas fa-print"></i> Print',
            'titleAttr'=>'Print',
            'className'=>'btn btn-sm btn-primary ml-2'
        ),
        array(
            'extend'=>'pdf',
            'text'=>'<i class="fas fa-file-pdf"></i> PDF',
            'titleAttr'=>'PDF',
            'className'=>'btn btn-sm btn-primary ml-2'
        ),
        //"colvis"
    ],
    "paging"=>true,
    "pageLength" => 10,
    "showFooter"=>true,
    "stateSave" => true,
    "themeBase"=>"bs4",
    "searching"=>true,
    "fixedHeader"=>true,
    "select"=>true,
),
"searchMode" => "and",
"cssClass"=>array(
    "table"=>"table table-centered mb-0 table-hover table-sm",
    'th' => 'reportHeader',
    'tr' => 'reportRow',
    'td' => function($row, $colName) {
        $s = is_numeric('1') ? '' : 'reportLabel';
        return $s;
    },
    'tf' => 'reportFooter',
    'button' => 'btn btn-primary'
),

));

David Winterburn commented on Feb 25, 2021

Hi,

Please add "l" (length) to your "dom" property like this:

    ...
    "dom" => 'Blfrtip',

Let us know if it works for you. Thanks!

Ammirati commented on Feb 25, 2021

Thanks, it works well ! Do you know where I can find all the options for dataTable and widgets ? The documentation at https://www.koolreport.com/docs/ is very light and there is not all options (like Blfrtip or how to change CSS on widgets).

David Winterburn commented on Feb 25, 2021

On client side of DataTables php widget we use the famous DataTables js. Here's a link to its "dom" property:

https://datatables.net/reference/option/dom

Any option of the DataTables js could be applied to DataTables php widget by converting it to php array in put it in "options" like this:

    DataTables::create(array(
        ...
        "options" => array(
            "dom" => ...
        )
    ));
Ammirati commented on Feb 25, 2021

Thanks David !

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
solved

DataGrid