A
A
Aliy Kunashev2020-08-11 08:49:28
1C-Bitrix
Aliy Kunashev, 2020-08-11 08:49:28

How to count pages in main.ui.grid navigation?

Colleagues, I want to use the Bitrix grid in public.
Data in ORM, output.
I pass NAV_OBJECT to the grid, formed as follows:

$grid_options = new Bitrix\Main\Grid\Options('my_list');
        $sort = $grid_options->GetSorting(['sort' => ['NAME' => 'DESC'], 'vars' => ['by' => 'by', 'order' => 'order']]);

        $nav_params = $grid_options->GetNavParams();

        $nav = new Bitrix\Main\UI\PageNavigation('my_list_nav');
        $nav->allowAllRecords(true)
            ->setPageSize($nav_params['nPageSize'])
            ->initFromUri();


There is a navigation bar, but it does not count the page size. There is categorically little time to read the source code, can anyone come across? Help out)

5f3230826db12130255047.png
Displays the selected amount, but does not paginate.

5f3230c4b6da7149923070.png
Here is the object itself, something seems to be missing here.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aliy Kunashev, 2020-08-11
@askunash

The answer is here
https://dev.1c-bitrix.ru/learning/course/index-new...
$nav->setRecordCount($controlsRes->getCount()); - it is necessary to set the total number of entries.
It was floating somewhere in the back of consciousness)
I was pleased with the documentation as usual) This method is not here.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question