Re: Ajax Sortable List Confusion

2007-04-11 Thread gerbenzomp

Nice job, I recently built something quite like this, only in my set-
up the widgets themselves are in fact "mini-controllers" using a
component and an element.

On 11 apr, 16:15, "Dustin" <[EMAIL PROTECTED]> wrote:
> Just an update to anyone looking for help with building a drag & drop
> interface in Cake.  I wrote a brief tutorial on my blog that should
> help resolve most basic issues/confusion with this particular aspect
> of Cake.  I tried to write it from the perspective of someone new to
> Cake and or with no previous experience with the $ajax->sortable()
> helper built into Cake.
>
> So, if you are stuck or scared of building your drag & drop interface,
> check it out:
>
> http://www.dustinweber.com/blog/_archives/2007/4/4/2859177.html
>
> Thanks!
> Dustin Weber


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Sortable List Confusion

2007-04-11 Thread Dustin

Just an update to anyone looking for help with building a drag & drop
interface in Cake.  I wrote a brief tutorial on my blog that should
help resolve most basic issues/confusion with this particular aspect
of Cake.  I tried to write it from the perspective of someone new to
Cake and or with no previous experience with the $ajax->sortable()
helper built into Cake.

So, if you are stuck or scared of building your drag & drop interface,
check it out:

http://www.dustinweber.com/blog/_archives/2007/4/4/2859177.html


Thanks!
Dustin Weber


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Sortable List Confusion

2007-03-30 Thread Dustin

No it turned out that it was correct as is.  The problem I was having
was related to Firebug I think.

However, I think as long as you are using the same controller to
handle the AJAX work/response as the view that created the page using
the AJAX call, you don't need to specify the longer URL.

I might be wrong on that, but I'm assuming if you wanted the AJAX call
to use a different controller, that's when you would specify the
longer url (ie controllername/action).  Am I wrong?

Regardless, it works now by just calling the action in the controller
(no need to add controllername/action).  It may not hurt to add it
though.

- Dustin Weber
http://www.dustinweber.com




On Mar 30, 10:23 am, "fr3nch13" <[EMAIL PROTECTED]> wrote:
> You have:
> sortable('questions', array('url' =>'saveOrder')); ?
>
>
>
> Shouldn't the url be /controller/action?
> so like this:
> sortable('questions', array('url' =>'/faq/
> saveorder/')); ?>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Sortable List Confusion

2007-03-30 Thread fr3nch13

You have:
sortable('questions', array('url' =>'saveOrder')); ?
>

Shouldn't the url be /controller/action?
so like this:
sortable('questions', array('url' =>'/faq/
saveorder/')); ?>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Sortable List Confusion

2007-03-29 Thread bernardo

I'm sorry if this sounds too obvious, but there has to be some
response (maybe it is an error or not); in your controller you have:
echo "made it!", where do you expect to see this? use firebug to see
the ajax request and the response and also the posted data. Also, if
you just want to update the database and not to render a view add:
$this->autoRender=false to saveOrder.

On Mar 29, 5:43 pm, "Dustin" <[EMAIL PROTECTED]> wrote:
> According the Live HTTP Headers (application to check headers), the
> ajax request is being made, but there doesn't seem to be a response
> from the saveOrder action.  Is there some sort of code to hand the
> ajax request that needs to be in the saveOrder action?
>
> Thanks,
>
> Dustin Weber
>
> On Mar 29, 11:44 am, "bernardo" <[EMAIL PROTECTED]> wrote:
>
> > Your code looks ok to me now. Have you checked with firebug that the
> > ajax request isn't made?
>
> > On Mar 29, 1:13 pm, "Dustin" <[EMAIL PROTECTED]> wrote:
>
> > > Bernardo,
>
> > > That made no difference.  The drag n' drop stuff graphically works,
> > > but it isn't contacting my saveOrder action in my controller.  I feel
> > > like I'm missing a bit of code somewhere that is the proverbial
> > > "missing link".  Do I need something in my controller action saveOrder
> > > for it to know to expect Ajax calls?
>
> > > The view now looks like this:
>
> > > Order View:
> > > 
> > >  > > if (isset($javascript)):
> > >echo $javascript->link('scriptaculous/lib/prototype.js');
> > >echo $javascript->link('scriptaculous/src/scriptaculous.js');
> > > endif;
> > > ?>
> > > 
> > > 
> > >  > > "\">" . $faq['Faq']['question'] . ""; ?>
> > > 
> > > 
> > > sortable('questions', array('url' =>
> > > 'saveOrder')); ?
> > > 
> > > > > onClick="window.location='../faqs';" />
> > > 
> > > 
>
> > > Dustin Weberhttp://www.dustinweber.com
>
> > > On Mar 29, 10:43 am, "bernardo" <[EMAIL PROTECTED]> wrote:
>
> > > > Try setting the id of the li to something like faq_1 faq_2 ... that is
> > > > they should end in an underscore and a number.
>
> > > > On Mar 29, 11:41 am, "Dustin" <[EMAIL PROTECTED]> wrote:
>
> > > > > I did my very best to search everywhere I could to solve this problem
> > > > > related to the $ajax->sortable helper.  Most of the posts are dated,
> > > > > so I apologize if I missed the answer somewhere else.
>
> > > > > Here's what I have:
>
> > > > > Controller snippets (related to this question):
> > > > > ---
> > > > > var $helpers = array('html', 'time', 'javascript', 'ajax');
>
> > > > > function saveOrder()
> > > > > {
> > > > > echo "made it!"; //just to check and see that it made it for 
> > > > > now
> > > > > //normally we would do some DB updating here instead
> > > > > }
> > > > > 
> > > > > *all my other actions work properly in this controller
>
> > > > > Order View:
> > > > > 
> > > > >  > > > > if (isset($javascript)):
> > > > >echo $javascript->link('scriptaculous/lib/prototype.js');
> > > > >echo $javascript->link('scriptaculous/src/scriptaculous.js');
> > > > > endif;
> > > > > ?>
>
> > > > > 
> > > > > 
> > > > >  > > > > style=\"margin:
> > > > > 5px; padding: 5px 5px; border: 1px solid #000; width: 500px; cursor:
> > > > > pointer;\">" . $faq['Faq']['question'] . ""; ?>
> > > > > 
> > > > > 
>
> > > > > sortable('questions', array('url' => 'saveOrder')); 
> > > > > ?
>
> > > > > 
> > > > > > > > > onClick="window.location='../faqs';" />
> > > > > 
> > > > > 
>
> > > > > Using just those two simple snippets, I get the sortable list
> > > > > graphically working in the view.  In simple terms, I can drag the
> > > > > boxes around with no problem.  However, the sortable helper isn't
> > > > > doing anything.  The controller action "saveOrder" never get's called
> > > > > by the helper.
>
> > > > > Am I missing something obvious here?  As I understand it, this is the
> > > > > only code I need in the view to get it working properly, am I wrong?
>
> > > > > Firebug shows no errors and I don't see anything that looks out of
> > > > > place or wrong in the generated source (when the page is built).
>
> > > > > Thanks for your help in advance,
>
> > > > > Dustin Weberhttp://www.dustinweber.com


--~--~-~--~~~---~--~-

Re: Ajax Sortable List Confusion

2007-03-29 Thread Dustin

According the Live HTTP Headers (application to check headers), the
ajax request is being made, but there doesn't seem to be a response
from the saveOrder action.  Is there some sort of code to hand the
ajax request that needs to be in the saveOrder action?

Thanks,

Dustin Weber




On Mar 29, 11:44 am, "bernardo" <[EMAIL PROTECTED]> wrote:
> Your code looks ok to me now. Have you checked with firebug that the
> ajax request isn't made?
>
> On Mar 29, 1:13 pm, "Dustin" <[EMAIL PROTECTED]> wrote:
>
> > Bernardo,
>
> > That made no difference.  The drag n' drop stuff graphically works,
> > but it isn't contacting my saveOrder action in my controller.  I feel
> > like I'm missing a bit of code somewhere that is the proverbial
> > "missing link".  Do I need something in my controller action saveOrder
> > for it to know to expect Ajax calls?
>
> > The view now looks like this:
>
> > Order View:
> > 
> >  > if (isset($javascript)):
> >echo $javascript->link('scriptaculous/lib/prototype.js');
> >echo $javascript->link('scriptaculous/src/scriptaculous.js');
> > endif;
> > ?>
> > 
> > 
> >  > "\">" . $faq['Faq']['question'] . ""; ?>
> > 
> > 
> > sortable('questions', array('url' =>
> > 'saveOrder')); ?
> > 
> > > onClick="window.location='../faqs';" />
> > 
> > 
>
> > Dustin Weberhttp://www.dustinweber.com
>
> > On Mar 29, 10:43 am, "bernardo" <[EMAIL PROTECTED]> wrote:
>
> > > Try setting the id of the li to something like faq_1 faq_2 ... that is
> > > they should end in an underscore and a number.
>
> > > On Mar 29, 11:41 am, "Dustin" <[EMAIL PROTECTED]> wrote:
>
> > > > I did my very best to search everywhere I could to solve this problem
> > > > related to the $ajax->sortable helper.  Most of the posts are dated,
> > > > so I apologize if I missed the answer somewhere else.
>
> > > > Here's what I have:
>
> > > > Controller snippets (related to this question):
> > > > ---
> > > > var $helpers = array('html', 'time', 'javascript', 'ajax');
>
> > > > function saveOrder()
> > > > {
> > > > echo "made it!"; //just to check and see that it made it for now
> > > > //normally we would do some DB updating here instead
> > > > }
> > > > 
> > > > *all my other actions work properly in this controller
>
> > > > Order View:
> > > > 
> > > >  > > > if (isset($javascript)):
> > > >echo $javascript->link('scriptaculous/lib/prototype.js');
> > > >echo $javascript->link('scriptaculous/src/scriptaculous.js');
> > > > endif;
> > > > ?>
>
> > > > 
> > > > 
> > > >  > > > style=\"margin:
> > > > 5px; padding: 5px 5px; border: 1px solid #000; width: 500px; cursor:
> > > > pointer;\">" . $faq['Faq']['question'] . ""; ?>
> > > > 
> > > > 
>
> > > > sortable('questions', array('url' => 'saveOrder')); ?
>
> > > > 
> > > > > > > onClick="window.location='../faqs';" />
> > > > 
> > > > 
>
> > > > Using just those two simple snippets, I get the sortable list
> > > > graphically working in the view.  In simple terms, I can drag the
> > > > boxes around with no problem.  However, the sortable helper isn't
> > > > doing anything.  The controller action "saveOrder" never get's called
> > > > by the helper.
>
> > > > Am I missing something obvious here?  As I understand it, this is the
> > > > only code I need in the view to get it working properly, am I wrong?
>
> > > > Firebug shows no errors and I don't see anything that looks out of
> > > > place or wrong in the generated source (when the page is built).
>
> > > > Thanks for your help in advance,
>
> > > > Dustin Weberhttp://www.dustinweber.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Sortable List Confusion

2007-03-29 Thread bernardo

Your code looks ok to me now. Have you checked with firebug that the
ajax request isn't made?

On Mar 29, 1:13 pm, "Dustin" <[EMAIL PROTECTED]> wrote:
> Bernardo,
>
> That made no difference.  The drag n' drop stuff graphically works,
> but it isn't contacting my saveOrder action in my controller.  I feel
> like I'm missing a bit of code somewhere that is the proverbial
> "missing link".  Do I need something in my controller action saveOrder
> for it to know to expect Ajax calls?
>
> The view now looks like this:
>
> Order View:
> 
>  if (isset($javascript)):
>echo $javascript->link('scriptaculous/lib/prototype.js');
>echo $javascript->link('scriptaculous/src/scriptaculous.js');
> endif;
> ?>
> 
> 
>  "\">" . $faq['Faq']['question'] . ""; ?>
> 
> 
> sortable('questions', array('url' =>
> 'saveOrder')); ?
> 
> onClick="window.location='../faqs';" />
> 
> 
>
> Dustin Weberhttp://www.dustinweber.com
>
> On Mar 29, 10:43 am, "bernardo" <[EMAIL PROTECTED]> wrote:
>
> > Try setting the id of the li to something like faq_1 faq_2 ... that is
> > they should end in an underscore and a number.
>
> > On Mar 29, 11:41 am, "Dustin" <[EMAIL PROTECTED]> wrote:
>
> > > I did my very best to search everywhere I could to solve this problem
> > > related to the $ajax->sortable helper.  Most of the posts are dated,
> > > so I apologize if I missed the answer somewhere else.
>
> > > Here's what I have:
>
> > > Controller snippets (related to this question):
> > > ---
> > > var $helpers = array('html', 'time', 'javascript', 'ajax');
>
> > > function saveOrder()
> > > {
> > > echo "made it!"; //just to check and see that it made it for now
> > > //normally we would do some DB updating here instead
> > > }
> > > 
> > > *all my other actions work properly in this controller
>
> > > Order View:
> > > 
> > >  > > if (isset($javascript)):
> > >echo $javascript->link('scriptaculous/lib/prototype.js');
> > >echo $javascript->link('scriptaculous/src/scriptaculous.js');
> > > endif;
> > > ?>
>
> > > 
> > > 
> > >  > > style=\"margin:
> > > 5px; padding: 5px 5px; border: 1px solid #000; width: 500px; cursor:
> > > pointer;\">" . $faq['Faq']['question'] . ""; ?>
> > > 
> > > 
>
> > > sortable('questions', array('url' => 'saveOrder')); ?
>
> > > 
> > > > > onClick="window.location='../faqs';" />
> > > 
> > > 
>
> > > Using just those two simple snippets, I get the sortable list
> > > graphically working in the view.  In simple terms, I can drag the
> > > boxes around with no problem.  However, the sortable helper isn't
> > > doing anything.  The controller action "saveOrder" never get's called
> > > by the helper.
>
> > > Am I missing something obvious here?  As I understand it, this is the
> > > only code I need in the view to get it working properly, am I wrong?
>
> > > Firebug shows no errors and I don't see anything that looks out of
> > > place or wrong in the generated source (when the page is built).
>
> > > Thanks for your help in advance,
>
> > > Dustin Weberhttp://www.dustinweber.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Sortable List Confusion

2007-03-29 Thread Dustin

Bernardo,

That made no difference.  The drag n' drop stuff graphically works,
but it isn't contacting my saveOrder action in my controller.  I feel
like I'm missing a bit of code somewhere that is the proverbial
"missing link".  Do I need something in my controller action saveOrder
for it to know to expect Ajax calls?

The view now looks like this:

Order View:

link('scriptaculous/lib/prototype.js');
   echo $javascript->link('scriptaculous/src/scriptaculous.js');
endif;
?>


" . $faq['Faq']['question'] . ""; ?>


sortable('questions', array('url' =>
'saveOrder')); ?

   



Dustin Weber
http://www.dustinweber.com








On Mar 29, 10:43 am, "bernardo" <[EMAIL PROTECTED]> wrote:
> Try setting the id of the li to something like faq_1 faq_2 ... that is
> they should end in an underscore and a number.
>
> On Mar 29, 11:41 am, "Dustin" <[EMAIL PROTECTED]> wrote:
>
> > I did my very best to search everywhere I could to solve this problem
> > related to the $ajax->sortable helper.  Most of the posts are dated,
> > so I apologize if I missed the answer somewhere else.
>
> > Here's what I have:
>
> > Controller snippets (related to this question):
> > ---
> > var $helpers = array('html', 'time', 'javascript', 'ajax');
>
> > function saveOrder()
> > {
> > echo "made it!"; //just to check and see that it made it for now
> > //normally we would do some DB updating here instead
> > }
> > 
> > *all my other actions work properly in this controller
>
> > Order View:
> > 
> >  > if (isset($javascript)):
> >echo $javascript->link('scriptaculous/lib/prototype.js');
> >echo $javascript->link('scriptaculous/src/scriptaculous.js');
> > endif;
> > ?>
>
> > 
> > 
> >  > style=\"margin:
> > 5px; padding: 5px 5px; border: 1px solid #000; width: 500px; cursor:
> > pointer;\">" . $faq['Faq']['question'] . ""; ?>
> > 
> > 
>
> > sortable('questions', array('url' => 'saveOrder')); ?
>
> > 
> > > onClick="window.location='../faqs';" />
> > 
> > 
>
> > Using just those two simple snippets, I get the sortable list
> > graphically working in the view.  In simple terms, I can drag the
> > boxes around with no problem.  However, the sortable helper isn't
> > doing anything.  The controller action "saveOrder" never get's called
> > by the helper.
>
> > Am I missing something obvious here?  As I understand it, this is the
> > only code I need in the view to get it working properly, am I wrong?
>
> > Firebug shows no errors and I don't see anything that looks out of
> > place or wrong in the generated source (when the page is built).
>
> > Thanks for your help in advance,
>
> > Dustin Weberhttp://www.dustinweber.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Ajax Sortable List Confusion

2007-03-29 Thread bernardo

Try setting the id of the li to something like faq_1 faq_2 ... that is
they should end in an underscore and a number.

On Mar 29, 11:41 am, "Dustin" <[EMAIL PROTECTED]> wrote:
> I did my very best to search everywhere I could to solve this problem
> related to the $ajax->sortable helper.  Most of the posts are dated,
> so I apologize if I missed the answer somewhere else.
>
> Here's what I have:
>
> Controller snippets (related to this question):
> ---
> var $helpers = array('html', 'time', 'javascript', 'ajax');
>
> function saveOrder()
> {
> echo "made it!"; //just to check and see that it made it for now
> //normally we would do some DB updating here instead
> }
> 
> *all my other actions work properly in this controller
>
> Order View:
> 
>  if (isset($javascript)):
>echo $javascript->link('scriptaculous/lib/prototype.js');
>echo $javascript->link('scriptaculous/src/scriptaculous.js');
> endif;
> ?>
>
> 
> 
>  style=\"margin:
> 5px; padding: 5px 5px; border: 1px solid #000; width: 500px; cursor:
> pointer;\">" . $faq['Faq']['question'] . ""; ?>
> 
> 
>
> sortable('questions', array('url' => 'saveOrder')); ?
>
>
>
> 
> onClick="window.location='../faqs';" />
> 
> 
>
> Using just those two simple snippets, I get the sortable list
> graphically working in the view.  In simple terms, I can drag the
> boxes around with no problem.  However, the sortable helper isn't
> doing anything.  The controller action "saveOrder" never get's called
> by the helper.
>
> Am I missing something obvious here?  As I understand it, this is the
> only code I need in the view to get it working properly, am I wrong?
>
> Firebug shows no errors and I don't see anything that looks out of
> place or wrong in the generated source (when the page is built).
>
> Thanks for your help in advance,
>
> Dustin Weberhttp://www.dustinweber.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Ajax Sortable List Confusion

2007-03-29 Thread Dustin

I did my very best to search everywhere I could to solve this problem
related to the $ajax->sortable helper.  Most of the posts are dated,
so I apologize if I missed the answer somewhere else.

Here's what I have:

Controller snippets (related to this question):
---
var $helpers = array('html', 'time', 'javascript', 'ajax');

function saveOrder()
{
echo "made it!"; //just to check and see that it made it for now
//normally we would do some DB updating here instead
}

*all my other actions work properly in this controller


Order View:

link('scriptaculous/lib/prototype.js');
   echo $javascript->link('scriptaculous/src/scriptaculous.js');
endif;
?>



" . $faq['Faq']['question'] . ""; ?>



sortable('questions', array('url' => 'saveOrder')); ?
>


   



Using just those two simple snippets, I get the sortable list
graphically working in the view.  In simple terms, I can drag the
boxes around with no problem.  However, the sortable helper isn't
doing anything.  The controller action "saveOrder" never get's called
by the helper.

Am I missing something obvious here?  As I understand it, this is the
only code I need in the view to get it working properly, am I wrong?

Firebug shows no errors and I don't see anything that looks out of
place or wrong in the generated source (when the page is built).

Thanks for your help in advance,

Dustin Weber
http://www.dustinweber.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---