コード例 #1
0
ファイル: SiteController.php プロジェクト: Aeryris/grid
function AddAutoCompleteToFields(Bvb_Grid_Event $event)
{
    $subject = $event->getSubject();
    $script = "\$(document).ready(function() {";
    foreach ($subject->getVisibleFields() as $name) {
        $script .= "\$(\"input#filter_{$name}\").autocomplete({focus: function(event, ui) " . "{document.getElementById('filter_{$name}').value = ui.item.value }," . " source: '{$subject->getAutoCompleteUrlForFilter($name)}'});\n";
    }
    $script .= "});";
    $subject->getView()->headScript()->appendScript($script);
}