views:

361

answers:

2

I need to have an autocomplete functionality using jquery, and I've encountered ZendX_JQuery which has such functionality available.

However, I've noticed that the entire ZendX_JQuery classes, are a bit old (the default jquery version is 1.3.2, and jquery ui 1.7.1). (see http://framework.zend.com/svn/framework/extras/branches/release-1.10/library/ZendX/JQuery.php)

Should I use that instead of my own written code to include the jquery library and etc., and should I use the ZendX_JQuery_View_Helper_AutoComplete class for such functionality ?

+2  A: 

ZendX is still active. I use jQueryUI for autocomplete. Below are examples of usage.

jQuery Configuration.

$view->jQuery()->setLocalPath('http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js')
                       ->enable()
                       ->setUiLocalPath('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js')
                       ->uiEnable()
                       ->addStylesheet('/ui/css/blitzer/jquery-ui-1.8.custom.css')

View file.

echo $this->autoComplete($id, $value, $params, $attribs);

http://jqueryui.com/demos/autocomplete/

http://framework.zend.com/manual/en/zendx.jquery.view.html

scopus
+2  A: 
$view->jQuery()
         ->setVersion('1.4.2')
         ->enable()
         ->setUiVersion('1.8.1')
         ->uiEnable()
         ->addStylesheet('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/ui-lightness/jquery-ui.css');

form element:

$el = $this->createElement('autoComplete', 'movie_id', 
        array(
            'cols'  => 30,
            'label' => 'Movie ID или Название фильма. Набрать 3 символа и подождать.',
            'required' => true,
            'autocomplete' => 'off',
            'filters' => array('StringTrim'),
            'validators' => array(
                'Int',
                array('Db_RecordExists', false, array(
                    'model' => 'Movies_Model_Movie',
                    'field' => 'id'
                ))
            ),
            'jQueryParams' => array(
                'source'    => $this->getView()->movieLinker()->crudListAutocompleteMovieId(),
                'minLength' => 3,

            )
        )
    );
SM