Drag n Drop - drop doesnt work

hi,

i use draggable and droppable widget and the dragging works fine.

but if i drag my draggable div into the droppable div, nothing happens.

anyone idea, i used the same scopes, but the draggable div always returns to its start position and the message, drop success never appears.




        <?

        $this->beginwidget('zii.widgets.jui.CJuiDraggable', array(

            'id' => 'draggable_test',

            'options' => array(

                'revert' => 'invalid',

                'cursor' => 'move',

                'scope' => 'test'

            )

                )

        );

        ?>


        <div style="float: left;">

            DRAGME

        </div>


        <? $this->endWidget(); ?>


        <?

        $this->beginWidget('zii.widgets.jui.CJuiDroppable', array(

            'id' => 'drop_test',

            'options' => array(

                'scope' => 'test',

                'drop' => 'js:function(event, ui){             

                              $("#dropmsg").html("drop success");               

                                     }'

            ),

        ));

        ?>

        <div style="float: left; height: 100px; width: 100px; background: #ccc">

            drag me here

        </div>

        <? $this->endWidget(); ?>

        

        <br>

        <span id="dropmsg">text replaced after drop success</span>



solved.

missed adding

‘htmlOptions’ => array(‘style’ => ‘float:left’)

to the widget

no clue why this is needed, but works…

You need it cuz your other layers are ‘floated’… check your html code. It all has to do with the styles… Have you tried without float:left in any of them? you will get what I say…

Cheers

Hello,

I would like to re-open this topic as I have a similar situation, but without any floats.

Actually I have not added any styles by hand. I am in the first phase of the proejct and everything is as yii delivers.

The situation is the following:

On a create-view I use the partial render to view a list-of-items and the _form view.

The create-view and _form_view is as created by Gii.

The list-of-item-view is this:


<?php 

foreach($items as $item): ?>

<div class="item" id="c<?php echo $item->id; ?>">

	</div>

	<div class="author">

		<?php echo $item->AuthorLink; ?>

                	

		<?php echo nl2br(CHtml::encode($item->text)); ?>

	

	</div>

</div>

<?php endforeach; ?>

My goal is to drag one of the items into some form fields.

I have succesffully added the draggable to each item.

But the droppable is not responding.

For testing, I have copied my dropable code and one field into the list-of-items view, and then the dropable works.

So I guess I have a similar situation like the above mentions.

But I am not using any floats and all styles and CSS is as given my yii.

Can you give me some hints what I have to check?

Thanks for any help with this…

gb5256