This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » Javascript plugins » Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()
Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #93345] Thu, 11 February 2010 17:13 Go to next message
lelio  is currently offline lelio
Messages: 7
Registered: June 2009
Location: Paris
Junior Member
Hello,
I'm not sure if this is the right place to post my question, so if i should post it somewhere else please let me know,

I am having problems with jq_draggable_element() and jq_drop_receiving_element(), i ve already used other helpers from the jquery helper and everything was ok;

To be more specific I am trying to and a drag and drop functionality to a table I add to the show template of a module, I have a module called “Contract” and another one called “ContractLot”, so what I am trying to do is drag and drop items of the ContractLot table (of the showContract) just for sorting purposes. It’s just like the promote demote function, but without the button 

I wasn’t able to find any good tutorial that explains how to use these helpers, I was able to achieve the drag and drop functionality without the helpers but it got ugly when I tried saving the new position.
So I decided to stick to the helpers

This is the only example I found on symfony website :
<ul id="items">
<li id="item_1" class="food">Carrot</li>
<?php echo draggable_element('item_1', array('revert' => true)) ?>
<li id="item_2" class="food">Apple</li>
<?php echo draggable_element('item_2', array('revert' => true)) ?>
<li id="item_3" class="food">Orange</li>
<?php echo draggable_element('item_3', array('revert' => true)) ?>
</ul>
<div id="cart">
<p>Your cart is empty</p>
<p>Drag items here to add them to your cart</p>
</div>
<?php echo drop_receiving_element('cart', array(
'url' => 'cart/add',
'accept' => 'food',
'update' => 'cart',
)) ?>

The only difference in my case is that I am not using unsorted list but table, and that my draggable elements should also be able to be drop receiving at the same time  I’m not even sure that’s possible. So in my case you just need to replace the <li> by <tr> of the table something like this :
<table>
<thead>
<tr><td>blabla</td></tr>
…….
</thead>
<tbody>
<tr id=”item_” (with the id of the element)><td></<td></tr>
<?php echo jq_draggable_element(‘item_’(id), array(‘revert’ => true))?>
<?php echo jq_drop_receiving_element(‘item_’(id), array(‘url’ => ‘@contract_lot_move’, ‘update’ => ‘id of the table’, ‘accept’ => ‘class of the tr’) ?>
</tbody>
</table>

I added the corresponding action, routes etc…
I tried passing with the url the id and rank as parameters… nothing
I have no errors in my code (I think, I would paste my code but its really messy) but the <tr> are draggable element I can see the script added by the helpers with firebug, but I cannot drag the row.

So if someone already used these helpers PLEAAASEE help I am going crazy, and I don’t know whats missing or if I should have done something differently
thanksss
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #95854 is a reply to message #93345 ] Sat, 20 March 2010 10:50 Go to previous messageGo to next message
peerffm  is currently offline peerffm
Messages: 18
Registered: February 2010
Location: China
Junior Member
ive have the some problem.
draggable_element('1', array('revert' => true)) ?>

is working, when i used prototype

i like used jquery . everything else is working in jquery

but this is not working . get no error
jq_draggable_element('1', array('revert' => true)) ?>


<p> Draggable </p>
<script type="text/javascript">
//<![CDATA[
jQuery("1").draggable({"revert":true})
//]]>
</script>
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #96540 is a reply to message #95854 ] Wed, 31 March 2010 16:57 Go to previous messageGo to next message
peerffm  is currently offline peerffm
Messages: 18
Registered: February 2010
Location: China
Junior Member

got this error

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://127.0.0.1/web/sfJqueryReloadedPlugin/js/jquery-1.3.2. min.js :: anonymous :: line 12" data: no]
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #96542 is a reply to message #96540 ] Wed, 31 March 2010 17:09 Go to previous messageGo to next message
lelio  is currently offline lelio
Messages: 7
Registered: June 2009
Location: Paris
Junior Member
I am still not able to make the draggable and droppable element work, but i didn't get the errors you got.
For now because of lack of time i am just doing a promote demote.
But if your able to find a solution I would really apreciate it if you could share it with us

thanks
best regards
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #96543 is a reply to message #96542 ] Wed, 31 March 2010 17:34 Go to previous messageGo to next message
peerffm  is currently offline peerffm
Messages: 18
Registered: February 2010
Location: China
Junior Member
got it working.

try
 <?php echo jq_draggable_element('#drag', $options=array('revert' => true)); ?>
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #96547 is a reply to message #96543 ] Wed, 31 March 2010 18:30 Go to previous messageGo to next message
peerffm  is currently offline peerffm
Messages: 18
Registered: February 2010
Location: China
Junior Member

but i got the problem when i used

echo jq_drop_receiving_element i got a error

Fatal error: Call to undefined function jq_get_ajax_options()

i dont understand where is the function

jq_get_ajax_options() ? i cant find it in jQueryHelper.php

but the function is called
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #96552 is a reply to message #96547 ] Wed, 31 March 2010 19:03 Go to previous messageGo to next message
lelio  is currently offline lelio
Messages: 7
Registered: June 2009
Location: Paris
Junior Member
I already got this message Smile
I know its weird to find a call to a function that doesn't exist

But after a lot of research I think this is a bug or something i found the folowing file (added file) with the missing function.
But even with the missing function i wasn't able to make it work Sad
So if you find a workaround plz let me know

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #96558 is a reply to message #96552 ] Wed, 31 March 2010 20:16 Go to previous messageGo to next message
peerffm  is currently offline peerffm
Messages: 18
Registered: February 2010
Location: China
Junior Member
got it.

try used this helperclass.

example

  <?php echo jq_draggable_element($Class->getId(), array('revert' => true ,'opacity' => 0.30)); ?>


<?php
echo jq_drop_receiving_element('#cart',array(
    'url'   =>  'xxx/xxx',
   'accept' => '.class',  (dont forgett the point)
   'update' => 'items',
    )) ?> 

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #100418 is a reply to message #96558 ] Fri, 04 June 2010 12:33 Go to previous messageGo to next message
jan_  is currently offline jan_
Messages: 23
Registered: September 2008
Junior Member
drag'n drop still doesn't work for me. Are the two new functions correct? I suspect them not to be, since I get 'undefined' in the id parameter after dropping an element.
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #100423 is a reply to message #100418 ] Fri, 04 June 2010 14:00 Go to previous messageGo to next message
peerffm  is currently offline peerffm
Messages: 18
Registered: February 2010
Location: China
Junior Member
it works for me correct.

have you tried with plain JQuery ?

maybe its a other problem with you application ?
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #100538 is a reply to message #100423 ] Mon, 07 June 2010 12:34 Go to previous messageGo to next message
jan_  is currently offline jan_
Messages: 23
Registered: September 2008
Junior Member
Yes, I tried with plain jQuery - same problem. But I haven't figured out yet how to solve it...
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #100542 is a reply to message #100538 ] Mon, 07 June 2010 13:11 Go to previous messageGo to next message
peerffm  is currently offline peerffm
Messages: 18
Registered: February 2010
Location: China
Junior Member
i know someone he have the same issue with Yii Framework (and integrated jquery)

maybe its something with the code.

[Updated on: Mon, 07 June 2010 13:12]

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #101485 is a reply to message #93345 ] Wed, 23 June 2010 13:35 Go to previous messageGo to next message
jan_  is currently offline jan_
Messages: 23
Registered: September 2008
Junior Member
FYI: I solved it by using plain jquery - without the plugin...
Works like a charm!
Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #101728 is a reply to message #101485 ] Mon, 28 June 2010 16:31 Go to previous messageGo to next message
defkrie  is currently offline defkrie
Messages: 3
Registered: June 2010
Junior Member
Hi,
What do you do to use in plain query ?

Have you have an example of project working with jq_draggable_element() and jq_drop_receiving_element() ?

thanks

[Updated on: Mon, 28 June 2010 16:31]

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element() [message #101751 is a reply to message #101485 ] Tue, 29 June 2010 11:22 Go to previous message
MaryDee  is currently offline MaryDee
Messages: 1
Registered: June 2010
Junior Member
jan_ wrote on Wed, 23 June 2010 13:35

FYI: I solved it by using plain jquery - without the plugin...
Works like a charm!


I would also greatly appreciate if you could share your solution Smile
Previous Topic:jquery autocomplete--not working...
Next Topic:why use php to create javascript?
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software