This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

Forum to discuss ExtJS and other JS plugins

Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by lelio » Thu Feb 11, 2010 6:13 pm

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
lelio
Junior Member
 
Posts: 7
Joined: Wed Jun 17, 2009 9:51 am
Location: Paris

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by peerffm » Sat Mar 20, 2010 11:50 am

ive have the some problem.
Code: Select all
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
Code: Select all
jq_draggable_element('1', array('revert' => true)) ?>


<p> Draggable </p>
<script type="text/javascript">
//<![CDATA[
jQuery("1").draggable({"revert":true})
//]]>
</script>
peerffm
Junior Member
 
Posts: 18
Joined: Thu Feb 04, 2010 9:28 am
Location: China

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by peerffm » Wed Mar 31, 2010 4:57 pm

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]
peerffm
Junior Member
 
Posts: 18
Joined: Thu Feb 04, 2010 9:28 am
Location: China

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by lelio » Wed Mar 31, 2010 5:09 pm

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
lelio
Junior Member
 
Posts: 7
Joined: Wed Jun 17, 2009 9:51 am
Location: Paris

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by peerffm » Wed Mar 31, 2010 5:34 pm

got it working.

try
Code: Select all
 <?php echo jq_draggable_element('#drag', $options=array('revert' => true)); ?>
peerffm
Junior Member
 
Posts: 18
Joined: Thu Feb 04, 2010 9:28 am
Location: China

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by peerffm » Wed Mar 31, 2010 6:30 pm

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
peerffm
Junior Member
 
Posts: 18
Joined: Thu Feb 04, 2010 9:28 am
Location: China

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by lelio » Wed Mar 31, 2010 7:03 pm

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
Attachments
jQueryAllFixHelper.php
(20.2 KiB) Downloaded 155 times
lelio
Junior Member
 
Posts: 7
Joined: Wed Jun 17, 2009 9:51 am
Location: Paris

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by peerffm » Wed Mar 31, 2010 8:16 pm

got it.

try used this helperclass.

example

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


Code: Select all
<?php
echo jq_drop_receiving_element('#cart',array(
    'url'   =>  'xxx/xxx',
   'accept' => '.class',  (dont forgett the point)
   'update' => 'items',
    )) ?>
Attachments
jQueryHelper.php
(28.79 KiB) Downloaded 172 times
peerffm
Junior Member
 
Posts: 18
Joined: Thu Feb 04, 2010 9:28 am
Location: China

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by jan_ » Fri Jun 04, 2010 12:33 pm

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.
jan_
Junior Member
 
Posts: 23
Joined: Tue Sep 23, 2008 11:46 am

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by peerffm » Fri Jun 04, 2010 2:00 pm

it works for me correct.

have you tried with plain JQuery ?

maybe its a other problem with you application ?
peerffm
Junior Member
 
Posts: 18
Joined: Thu Feb 04, 2010 9:28 am
Location: China

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by jan_ » Mon Jun 07, 2010 12:34 pm

Yes, I tried with plain jQuery - same problem. But I haven't figured out yet how to solve it...
jan_
Junior Member
 
Posts: 23
Joined: Tue Sep 23, 2008 11:46 am

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by peerffm » Mon Jun 07, 2010 1:11 pm

i know someone he have the same issue with Yii Framework (and integrated jquery)

maybe its something with the code.
peerffm
Junior Member
 
Posts: 18
Joined: Thu Feb 04, 2010 9:28 am
Location: China

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by jan_ » Wed Jun 23, 2010 1:35 pm

FYI: I solved it by using plain jquery - without the plugin...
Works like a charm!
jan_
Junior Member
 
Posts: 23
Joined: Tue Sep 23, 2008 11:46 am

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by defkrie » Mon Jun 28, 2010 4:31 pm

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
defkrie
Junior Member
 
Posts: 3
Joined: Mon Jun 28, 2010 4:29 pm

Re: Jquery Helper=> jq_draggable_element() and jq_drop_receiving_element()

by MaryDee » Tue Jun 29, 2010 11:22 am

jan_ wrote: 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:
MaryDee
Junior Member
 
Posts: 1
Joined: Tue Jun 29, 2010 11:18 am