×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Pagination problem
Simon
New Member
Posts: 3
10 năm 2 tuần trước #454
bởi Simon
Pagination problem was created by Simon
hello,
First of all thank you for your utility. It is very powerful and easy to use, the generated code is clean ... great.
Just one problem I encounter several months I use component creator:
I can not handle paging.
The default is random (page 16 items first, second page 20 ...) ...
In addition, when returns on the component, paging stays on the page on which it was when the left ...
I can not find an option to manage it in the creation of the component and when I try to change it in the php, it does not work.
print_r () on $ this-> pagination gives:
but on this page, I have 16 items and 18 of the following ...
weird...
First of all thank you for your utility. It is very powerful and easy to use, the generated code is clean ... great.
Just one problem I encounter several months I use component creator:
I can not handle paging.
The default is random (page 16 items first, second page 20 ...) ...
In addition, when returns on the component, paging stays on the page on which it was when the left ...
I can not find an option to manage it in the creation of the component and when I try to change it in the php, it does not work.
print_r () on $ this-> pagination gives:
(
[limitstart] => 0
[limit] => 20
[total] => 44
[prefix] =>
[pagesStart] => 1
[pagesStop] => 3
[pagesCurrent] => 1
[pagesTotal] => 3
[viewall: protected] =>
[additionalUrlParams: protected] => Array
(
)
)
but on this page, I have 16 items and 18 of the following ...
weird...
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Simon
New Member
Posts: 3
10 năm 2 ngày trước #471
bởi Simon
Replied by Simon on topic Pagination problem
nobody has an idea? it would help me a lot.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Simon
New Member
Posts: 3
10 năm 2 ngày trước #474
bởi Simon
Replied by Simon on topic Pagination problem
I just followed your advice. Thank you.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
John Benac
New Member
Posts: 5
8 năm 5 tháng trước #1323
bởi John Benac
Replied by John Benac on topic Pagination problem
This is the second time that I have come to the forums and found a question asked in the past that I now face. The answer is the same as last time: "contact support."
It would really be great if the answers to these questions were posted back at the forum the last time that someone solved it so that others could benefit from the work previously done.
I dont want pagination. At all. How do I disable it? How do I control it?
It would really be great if the answers to these questions were posted back at the forum the last time that someone solved it so that others could benefit from the work previously done.
I dont want pagination. At all. How do I disable it? How do I control it?
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
John Benac
New Member
Posts: 5
8 năm 5 tháng trước - 8 năm 5 tháng trước #1324
bởi John Benac
Replied by John Benac on topic Pagination problem
I found a solution as follows:
in the model file for your view, look for this code:
protected function populateState($ordering = null, $direction = null)
{
// Initialise variables.
$app = JFactory::getApplication();
// List state information
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'));
Change the line:
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'));
to this
$limit = 50;
or whatever number you want.
If you try to set the pagination property of the JPagination object in the view to something else, then the object will be modified (as verifiable through) var_dumping the pagination property to the screen, but the changes in limits will not have been made prior to the records being pulled from the server. Thats why you have to hack the model itself and short-circuit the call to the global list limit for the app.
There is probably a more thoughtful way to do this. Does anyone know a way to change the global value?
in the model file for your view, look for this code:
protected function populateState($ordering = null, $direction = null)
{
// Initialise variables.
$app = JFactory::getApplication();
// List state information
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'));
Change the line:
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'));
to this
$limit = 50;
or whatever number you want.
If you try to set the pagination property of the JPagination object in the view to something else, then the object will be modified (as verifiable through) var_dumping the pagination property to the screen, but the changes in limits will not have been made prior to the records being pulled from the server. Thats why you have to hack the model itself and short-circuit the call to the global list limit for the app.
There is probably a more thoughtful way to do this. Does anyone know a way to change the global value?
Last edit: 8 năm 5 tháng trước by John Benac. Lý do: I'm providing the answer, whereas before I was asking.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Stargazer
New Member
Posts: 3
1 năm 5 tháng trước #10141
bởi Stargazer
Replied by Stargazer on topic Pagination problem
In Joomla 4 components look in the model file for your view, look for THIS code:
protected function populateState($ordering = null, $direction = null)
{
// List state information.
parent::populateState('a.id', 'ASC');
$app = Factory::getApplication();
$list = $app->getUserState($this->context . '.list');
$value = $app->getUserState($this->context . '.list.limit', $app->get('list_limit', 25));
$list = $value;
$this->setState('list.limit', $value);
Change the $value variable to an integer and it will display that number of results, for example:
$this->setState('list.limit', 50);
If you change the value to "null" it will return all of the results, for example:
$this->setState('list.limit', null);
protected function populateState($ordering = null, $direction = null)
{
// List state information.
parent::populateState('a.id', 'ASC');
$app = Factory::getApplication();
$list = $app->getUserState($this->context . '.list');
$value = $app->getUserState($this->context . '.list.limit', $app->get('list_limit', 25));
$list = $value;
$this->setState('list.limit', $value);
Change the $value variable to an integer and it will display that number of results, for example:
$this->setState('list.limit', 50);
If you change the value to "null" it will return all of the results, for example:
$this->setState('list.limit', null);
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Thời gian tải trang: 0.055 giây