How Can We Help?

Create a Grid to list users of a Company

 
Deepser grids are a very powerful and flexible tool.
This How To explains how to configure a grid to list the users of only one company.
To configure a new grid click the button “arrow” that shows all the grids in the system and select the item New Grid.

 

We can see the popup to insert the name of the grid.

 

Insert the name of the grid. The new grid is created with the default settings.

 

Go inside the grid configuration by clicking on the button to modify the grid.

 

We can see the form to edit that grid. Select the visibile fields and drop them in the middle of the screen under the column “Visibile fields”. The fields we don’t want to display must be dragged&dropped on the left side of the screen.

 

Now the grid will display all the users and the fields under Available Columns.
To filter the users by a company (in our example we will filter the company INTODEEP), first of all we have to know the ID of that company.
To do that open another tab in the browser and access the Company menu: System > Company. Write down the ID of the company.

 

Now, come back to the grid configuration and in the field Prepared Collection write the following PHP code:
[php]$this->getCollection()->addFieldToFilter(‘company_id’, [‘eq’ => 3]);[/php]

Dove:

  • $this is the current object: the grid.
  • getCollection() is the collection of elements in the grid.
  • addFieldToFilter() we can add with this function a filter to the collection.
  • company_id is the field with the ID of the company.
  • [‘eq’ => 3] expression to tell Deepser that we want only the users with ‘company_id’ = 3, where 3 is the ID of our company.

Now we can see the grid is filtered by our company.

 

In this section, what we have seen for the grids configuration is enough, but grids can be highly customized.
The details of the grids customization is here: Custom Grids.

Previous Introduce a new Service in the User Portal
Next Reset User Password
Table of Contents