Html builder - search parameter

Html builder - search parameter

Olivier_1968Olivier_1968 Posts: 3Questions: 1Answers: 0

Hello community !!
I'm beginner with datatable, i'm using PHP Laravel 8.
I created an html builder to setup my datatable with the following code :

$builder = $this->builder()
            ->columns($this->getColumns())
            ->minifiedAjax()
            ->parameters([
                'search' => ['return' => true],
                'responsive' => true,
                'dom'       => 'Bfrtip',
                'language' => ['url' => Utilities::getFileLocationDatatable()],
                'stateSave' => true,
                'order'     => [[0, 'desc']],
                'buttons'   => [

                ],
                'drawCallback' => "function() {
                    $('[data-toggle=\"tooltip\"]').tooltip();
                }",
            ]);

But strangely the parameter 'search' => ['return' => true] seems not working, the goal is to run search when 'enter' key is pressed but it run search everytime any key is pressed in search zone.

I'm really beginner so i may misunderstood the syntaxe of the documentation, be indulgent.

Thanks in advance

Olivier

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    I don't know about Laravel 8, but search is an object, so you may need to replace:

     'search' => ['return' => true]
    

    with

     'search' => { 'return' => true }
    

    Colin

  • Olivier_1968Olivier_1968 Posts: 3Questions: 1Answers: 0

    Thanks for your reply Colin, but the syntaxe is correct, to acces an object in laravel 'search' => ['return' => true] is ok

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    Are you using DataTables 1.11? search.return was introduced in 1.11.0 (current release is 1.11.5 as I write this).

    If that isn't the issue, then we'll need a link to a page showing the issue to be able to debug it.

    Allan

  • Olivier_1968Olivier_1968 Posts: 3Questions: 1Answers: 0

    Thanks Allan, we are using on older version.
    Willl try to update it.

    Olivier

Sign In or Register to comment.