I would like to implement a list into backend controller for my users under a new tab.
https://ibb.co/fkAWFR (Add Tab Field)
UsersController::extendFormFields(function($form, $model, $context){
if (!$model instanceof UserModel)
return;
if (!$model->exists)
return;
$form->addTabFields([
'activity' => [
'tab' => 'Activity',
'type' => 'partial',
'path' => '$/acme/plugin/controllers/viewedjobs/_viewed_jobs.htm'
]
]);
});
https://ibb.co/ktHdvR (include this list)
My _viewed_jobs.htm partial looks like this:
listRender() ?>Which throws an error about list behavior not being initialized. After some looking I found these posts: https://octobercms.com/forum/post/listcontroller-error-need-help
So I added
$this->asExtension('ListController')->index()
to the partial and now it displays my user list controller.
I would like to display a list for my ViewedJobs controller. I also watched the tutorial here: https://octobercms.com/support/article/ob-21 to create my list manually, however, the variables are not defined when I use this code.
I also tried creating a new list config under the Users plugin (which I know is not a best practice) but it throws and error about groups() method not found.
you can easily show lists.
I assume that you are using rain-lab user plugin and current UsersController is rain lab's user controller
and you have job table and have mm relation between user and job tabel
you need to put this code in your plugin's boot method
if its not working then please comment