I created an demo according https://github.com/atk4/money-lending-tutorial/blob/master/tutorial/en/step1.md , it works, but I can not manage to integrate the https://github.com/atk4/autocomplete addon.
Can someone point me to:
1. how can I install it? (I done in via modifiing the composer.json by adding "atk4/autocomplete": "dev-master"
and composer install
command)
2. how can I autoload/integrate it?
3. how can I use it? The samples says $this->hasOne('User')->display(...);
, but no display()
function is defined.
答案 0 :(得分:2)
更新:自动填充功能现已成为Agile UI的一部分
http://ui.agiletoolkit.org/demos/autocomplete.php
可以像以下一样简单:
$form->addField('country3', [
'AutoComplete',
'model' => new Country($db),
'placeholder' => 'Search for country by code, LV or UK',
'search' => ['name', 'iso', 'iso3'],
]);
旧答案
不幸的是," atk4 / autocomplete"与Agile UI / Agile Data不兼容,因此可能需要重写一次。
使用Agile UI实现AutoComplete:
了解回调和虚拟网页:http://agile-ui.readthedocs.io/en/latest/core.html#callbacks-and-virtual-pages
使用回调创建自己的自动完成字段类。
在Agile UI / Data中实现自动完成实际上不应该超过10行代码。