atk4/mastercrud

Re editing relational data using Autocomplete in modal.

ibelar opened this issue · 1 comments

Autocomplete field is not populate with table data when editing a record using a modal.

$app = new \xpdcloud\Admin\App();
$app->add(new \atk4\mastercrud\MasterCRUD())
    ->setModel(new xpdcloud\Model\Customer($app->db),
               [
                   'CustomerPhones'=>[],
                   'CustomerAddress'=>[
                   ],
               ]);

class CustomerAddress extends \atk4\data\Model
{
    public $table = 'customer_address';
    public $title_field = 'type';
    public $title = 'Address';
    function init()
    {
        parent::init();

        $this->addField('type');
        // Field Declaration
        $this->hasOne('customer_id', new Customer());
        $this->hasOne('address_id', [new Address(), 'ui'=>['form'=>['AutoComplete', 'plus'=>true]] ])
            ->addTitle();
        $this->addField('created_on', array('type' => 'datetime', 'system' => 1, 'default' => date('Y-m-d H:i:s')));
    }
}

When editing back the CustomerAddress via the modal dialog, using the grid edit button, then the autocomplete input in modal is not populate with data.

If editing the record via the link using another tab, then autocomplete is workging fine.

Screen shot using a modal edit
mc-using-modal-edit

Screen shot using tab edit:
mc-using-tab-edit

Autocomplete field data is populate correctly in Tab edit but not in Modal edit.

is that an issue with mastercrud?