Ajax double click dblclick

Hey, guys,

Is it possible to setup a listbox double click event by using the CHtml::ajax property?

e.g:




echo CHtml::activeListBox($model, 'parentId',

		CHtml::listData(Category::model()->published()->findAll($criteria), 'id', 'categoryName'),

		array(

		    'size'=>6,

		    'ajax'=>array(

'event'=>'dblclick',  //==========> is there something like this or something that changes the trigger to dblclick instead of click?

			'type'=>'POST',

			'url'=>Yii::app()->urlManager->createUrl('/category/dynSubcategories'),

			'update'=>'#Category_parentId',

		    )

		)



In my Categories form, I want to allow users to navigate among child categories by double-clicking the name of a category and to select the category by single-clicking over it

Is there any way to do this without writing jquery native code, I mean, by using Yii’s built-in classes?

Thanks in advance

:)

regards

solved!

thanks for all your help!!

:)

would be nice if you would post the solution…

I guess that is a sarchastic post, because none answered him for 17 days…

hehe…not at all, zaccaria, actually, yes and no… just posted to close the topic and inform people that the problem was solved, but in fact, since some time ago, don’t know why, i havent been receiving replies to my topics, even in Yiiplayground’s topic when we (Giovanni and I) posted that there may have a bug in rendering widgets with CWidgetFactory theme set…

mdomba:

as i haven’t found any way to pass dblclick as trigger to the built-in ajax, i’ve made it in jquery as follows:




<?php

Yii::app()->clientScript->registerScript('dynDep',

	'

 $(document).ready(function() {

	$("#Offer_departmentId").dblclick(function() {

//do any stuff

			jQuery.ajax(

				{

				"type":"POST",

				"url":"/app/backend.php?r=department/dynSubdepartments",

				"cache":false,

				"data":jQuery(this).parents("form").serialize(),

				"success":function(html){

								jQuery("#Offer_departmentId").

								html(html)

							}

				}

			);

//do any other stuff

		return false;

	});

 });

'

	,CClientScript::POS_READY

	);


?>



i think that it would be nice if in ajax we could choose the trigger and why not setting various ajax calls to the same control?

like




somecontrol(

'ajax' = array(

    'click'=>array('function(){alert"click";}', 'url'=>"controller/action", 'update'=>'#myid'),

    'dblclick'=>array('function(){alert"click";}', 'url'=>"controller/action", 'update'=>'#anotherid'),

)

)



what do you guys think about it? is it already possible to do? tks

regards!!

:)

CHtml::ajax() is a PHP wrapper for the jQuery ajax() that does not have this options - http://api.jquery.com/jQuery.ajax/#options

I don’t see an easy way to implement this… will need to think more about this…

I see your point…thanks for considering this

in CHtml.php there are lots of places when the following code appears




self::clientChange('click',$htmlOptions);



but i couldnt figure out how to specify the clientChange for a text or dropdown list

regards!!

maybe you can do without registering a function.

What about:




echo CHtml::activeListBox($model, 'parentId',

                CHtml::listData(Category::model()->published()->findAll($criteria), 'id', 'categoryName'),

                array(

                    'size'=>6,

                    'dblclick'=CHtml::ajax("url":"/app/backend.php?r=department/dynSubdepartments", 'replace'=>#Offer_departmentId),

                    )

                )



It should do the trick

zaccaria, i’ve played around your suggestion, but it gives parse error, does it work for you?

tks

I didn’t tested it…

It is just a sample, not a real solution. By the way, #Offer_departmentId should be at least among ‘’… sorry

It would not work anyway as the framework does not check the ‘dblclick’ keyword…

this was posted two years ago, what about today? is "dblclick" event considered by yii?