I created my component with an option "perPage", that acept an number and set the limit of works displayer per page...
public function defineProperties()
{
return [
'perPage' => [
'title' => 'Number os works per page',
'description' => 'How many works do you want to display per page?',
'default' => 9,
'validationPattern' => '^[0-9]+$',
'validationMessage' => 'Only numbers allowed'
],
'sortOrder' => [
'title' => 'Order of Works',
'description' => 'How do you want to order the actors',
'type' => 'dropdown',
'default' => 'newest',
],
];
}
It work's great with GET implementation... but on my project I need to implement AJAX everywhere, so I need to load pages via AJAX, and I need to know what the number was setted on a component... How I can get this number?
//my layout code
function onOpenWorkList()
{
$this['works'] = Category::where('slug', input('slug'))->first();
$this['categories'] = Category::all();
$this['active_category'] = input('slug');
$this['perPage'] = ""; // HERE IS THE CODE
return [
'.home_categories' => $this->renderPartial('work_list_categories_post'),
'.container' => $this->renderPartial('work_list')
];
}
via Ivan Dunets