Open jettero777 opened 2 years ago
Thanks for the report, i'll check that. Could you please post me your ngRestConfig parts, so we can easy reproduce?
Hi @nadar sure, here simplified config for testing
<?php
namespace app\modules\test\models;
use luya\admin\ngrest\base\NgRestModel;
class Test extends NgRestModel
{
public static function tableName()
{
return 'test';
}
public static function ngRestApiEndpoint()
{
return 'api-test';
}
public function ngRestAttributeTypes()
{
return [
'is_active' => [
'toggleStatus',
'initValue' => 0,
],
'user_id' => [
'SelectRelationActiveQuery',
'query' => $this->getUser(),
'labelField' => 'id',
],
];
}
public function rules()
{
return [
[['is_active', 'user_id'], 'safe'],
];
}
public function ngRestScopes()
{
return [
[['list', 'create', 'update'], ['is_active', 'user_id']],
];
}
public function ngRestPools()
{
return [
'inactive' => ['is_active' => 0],
'active' => ['is_active' => 1],
];
}
public function getUser()
{
return $this->hasOne(
User::class, ['id' => 'user_id']
);
}
}
public function getMenu()
{
return (new AdminMenuBuilder($this))
->node('Test', 'person')
->group('test')
->itemApi('Test1', 'test/test/index', 'person', 'api-test')
->itemPoolApi('Test2', 'test/test/index', 'person', 'api-test', 'inactive')
->itemPoolApi('Test3', 'test/test/index', 'person', 'api-test', 'active');
}
What steps will reproduce the problem?
plugin SelectRelationActiveQuery used in a model with pool api
What is the expected result?
should be shown a button to select related records
What do you get instead? (A Screenshot can help us a lot!)
there is no button to choose records if plugin used in a model without pool, then the button is visible and works as expected
Additional infos