E
E
EVOSandru62015-11-05 14:43:19
JavaScript
EVOSandru6, 2015-11-05 14:43:19

Why does the CJuiAutoComplete dropdown disappear when hovering the mouse in isAjaxRequest mode?

Good afternoon, there is such a problem,

There is a widget,

CJuiAutoComplete

$this->widget('zii.widgets.jui.CJuiAutoComplete',
      [
                'name'=>'place_id',
                'value'=>'',
                 'source'=>Yii::app()->createUrl('places/autocomplete'),
                  'options'=>
                  [
                          'showAnim'  =>  'fold',
                           'minLength' =>  '3',
                            'select'    =>  'js:function( event, ui )
                             {
                             $("#placeSearch").val( ui.item.label );
                              $("#place_id").val( ui.item.id );
                               return false;
                             }',
                     ],
                      'htmlOptions'=>
                      [
                             'onfocus' => 'js: 
                                   this.value = null; $("#place_id").val(null);   
                                   $("#selectedvalue").val(null);',
                                    'class' => 'input-xxlarge search-query',
                                    'name' => 'Hotels[place_id]',
                                    'placeholder' => $model->place_id ? $model->place->name :                      
                                    "Введите первые 3 и более буквы региона",
                                    'id'=>'placeSearch'
                      ],
        ]);


There is a need to reload the block with the form containing the data of 2 widgets via ajax/jquery and renderPartial in the controller:

Yii::app()->clientScript->scriptMap =
  [
    'jquery.js' 				=> false,
    'jquery.ui.js' 			=> false,
    'jquery.yiiactiveform.js' 	=> false,
  ];

  $this->renderPartial('_formAjax',
    [
      'model'		=>	$model,
      'customers'	=>	$customers,
      'managers'	=>	$managers,
      'hotels'	=>	$hotels,
    ], false, true);
    Yii::app()->end();


jquery scripts are not duplicated. The problem is the following: Before updating, both widgets work well, but after the following happens:

The drop-down list drops out, but the event specified in the widget stops working:

'select'    =>  'js:function( event, ui )
{
       $("#placeSearch").val( ui.item.label );
       $("#place_id").val( ui.item.id );
       return false;
}


More precisely, when you hover over the list, wanting to select an item, the entire list disappears. ul turns into display:none

I tried to make a crutch so that when hovering over the dropdown, it would remain display:block

After it disappears, it becomes display:none and hangs in firebug

<?php if(Yii::app()->request->isAjaxRequest):   // && !isset($_GET['term']) ?>

    <script type="text/javascript">

            var elem = $('.ui-autocomplete.ui-menu.ui-widget.ui-widget-content.ui-corner-all');

            elem.mouseenter(function()
            {
                console.log('Навели');
            });

</script>

<?php endif;?>


But the console does not write anything, therefore my events interrupt the events of the component from the widget

How to make it so that when hovering over the drop-down list does not disappear? He is very needed, you can write crutches with him, but he is a bastard disappearing.
Tell me please! Maybe someone came across.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question