3

Does someone know in which file exactly can I delete the filter result label at the list view? For example, say that I have a list of teams, and in each team, I also have a list of users. I want to filter out the users that are not inside the team's menu that I'm visiting right now. So i use $this->crud->addClause() method provided by Backpack. What I don't want is that after the filter has run, it shows me the Showing 1 to 1 of 1 entry (filtered from 4 total entries). Reset label. Of course, I don't want my user to know how many users I'm having inside my DB(you can see it from the filtered from 4 total entries label), that's why I want to remove that label. Does anyone know how to do that? Thanks. By the way, here's the label located :

List of users view image

avocadoLambda
  • 1,332
  • 7
  • 16
  • 33
felixbmmm
  • 362
  • 3
  • 13

5 Answers5

1

you could hide it using something like:

@push('after_scripts')
<script>
        $(document).ready(function () {
            $(".dataTables_info").hide()});
</script>
@endpush

add the previous code to the end of your resources/views/vendor/backpack/base/inc/topbar_right_content.blade.php file

it will hide the overall statistics ..

OMR
  • 11,736
  • 5
  • 20
  • 35
1

Internally, Backpack use DataTables for CRUDs list operations. Looking at DataTable's documentation, there's an option to disable the records count / filtered records info.

Backpack's DataTable is setup in datatables_logic.blade.php which is located at /vendor/backpack/crud/src/resources/views/crud/inc

If a blade file with the exact name exists in resources/views/vendor/backpack/crud folder, Backpack will pick up that instead, so all you have to do is

  1. Copy the original datatables_logic.blade.php into WhateverYourAppNameIs/resources/views/vendor/backpack/crud/inc/datatables_logic.blade.php

  2. Edit the file & locate this (around line 88)

      dataTableConfiguration: {         
      @if ($crud->getResponsiveTable())
    

And change it into this

      dataTableConfiguration: {         
      "info": false,
      @if ($crud->getResponsiveTable())

That's it. Filtered records count is gone.

Dharman
  • 30,962
  • 25
  • 85
  • 135
rbndeveloper
  • 123
  • 2
  • 8
0

If you just want to hide the filtered from 4 total entries label

Do what @rbndeveloper had mention to copy the datatables_logic.blade.php

Inside the file do the below changes.

go to

"infoFiltered":   "{{ trans('backpack::crud.infoFiltered') }}",

change to

"infoFiltered":   "",

You have to the total record removed.

Shiro
  • 7,344
  • 8
  • 46
  • 80
0

You can overwrite the ListOperation::search() method in your EntityCrudController and change like this:
Instead of

$totalRows = $this->crud->model->count();

Write

$totalRows = $this->crud->count();

Now you'll only see the line

"Showing x to x of x entries"

.
and

"filtered from x total entries"

will be removed now because the total records are equal to the fetched records.

Tayyab Yasin
  • 37
  • 1
  • 10
0

Open list.php from /config/backpack/operations/list.php

To remove the count set showEntryCount to false

'showEntryCount' => false,

To remove the reset button set resetButton to false

'resetButton' => false,