atk4 / mastercrud

Manipulates ATK CRUD through the force of references
https://atk4.org
MIT License
9 stars 7 forks source link

Re editing relational data using Autocomplete in modal. #1

Open ibelar opened 6 years ago

ibelar commented 6 years ago

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.

romaninsh commented 6 years ago

is that an issue with mastercrud?