Re: CakePHP 1.3, JSHelper and Autocomplete, Missing method?

2011-03-06 Thread Michael T
So Nic, you got it to work? I didn't have to change the $_callbackArguments 
field; I just modified the callback arguments within my implementation of 
autocomplete().

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 1.3, JSHelper and Autocomplete, Missing method?

2011-02-21 Thread Nic

Sent from my iPhone

On Feb 21, 2011, at 1:42 AM, "Nic [via CakePHP]" <
ml-node+3393716-227172156-150...@n5.nabble.com> wrote:

You will also need to add this as part of the $_callbackArguments :

'autocomplete' => array(
'search' => 'event, ui',
'open' => 'event, ui',
'focus' => 'event, ui',
'select' => 'event, ui',
'close' => 'event, ui',
'change' => 'event, ui',
),


--
 If you reply to this email, your message will be added to the discussion
below:
http://cakephp.1045679.n5.nabble.com/CakePHP-1-3-JSHelper-and-Autocomplete-Missing-method-tp3270384p3393716.html
 To unsubscribe from CakePHP 1.3, JSHelper and Autocomplete, Missing
method?, click 
here.

-- 
View this message in context: 
http://cakephp.1045679.n5.nabble.com/CakePHP-1-3-JSHelper-and-Autocomplete-Missing-method-tp3270384p3393732.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 1.3, JSHelper and Autocomplete, Missing method?

2011-02-21 Thread Nic

You will also need to add this as part of the $_callbackArguments :

'autocomplete' => array(
'search' => 'event, ui',
'open' => 'event, ui',
'focus' => 'event, ui',
'select' => 'event, ui',
'close' => 'event, ui',
'change' => 'event, ui',
),

-- 
View this message in context: 
http://cakephp.1045679.n5.nabble.com/CakePHP-1-3-JSHelper-and-Autocomplete-Missing-method-tp3270384p3393716.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 1.3, JSHelper and Autocomplete, Missing method?

2011-02-21 Thread nic

How did you get autocomplete to work with jQuery? I can only find it separate
with jQuery UI and nothing as to how they work together ... or am I missing
something and way off from the start here?
-- 
View this message in context: 
http://cakephp.1045679.n5.nabble.com/CakePHP-1-3-JSHelper-and-Autocomplete-Missing-method-tp3270384p3393619.html
Sent from the CakePHP mailing list archive at Nabble.com.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: CakePHP 1.3, JSHelper and Autocomplete, Missing method?

2010-11-23 Thread Michael T
I ran into this issue a while ago. I decided to add the autocomplete
method to the JsHelper / jQuery engine myself. Here's what you need to
do.

In jquery_engine.php, you need to create an autocomplete method. You
can copy/paste from a similar method e.g. the 'sortable' method. You
might want to make some modifications regarding the callback functions
that you pass in the options argument. This is what I had in the end:

/**
 * Create an autocomplete element.
 *
 * @param array $options Array of options for the autocomplete.
 * @return string Completed autocomplete script.
 * @access public
 * @see JsBaseEngineHelper::autocomplete() for options list.
 */
function autocomplete($options = array()) {
$template = '%s.autocomplete({%s});';
// don't escape the 'select' or 'search' functions
$callbacks = array('select', 'search');
return $this->_methodTemplate('autocomplete', $template, 
$options,
$callbacks);
}

Note that if you want to use Autocomplete's custom rendering (http://
jqueryui.com/demos/autocomplete/#custom-data), you'll have to change
the template above and allow for additional arguments that specify the
rendering function.

If you want to make the rendered JS for the autocomplete appear in the
JS buffer, you need to add your 'autocomplete' method to the list of
bufferedMethods in the JsBaseEngineHelper class (js.php).

That should be it! You can then use your autocomplete in your view
like this:

$this->Js->get('#employee_autocomplete')->autocomplete(
array(  'source' => $this->Html-
>url(array('controller'=>'employees',
'action'=>'get_employee_names')),
'minLength' => 3,
'search' => 'function (event, ui) { ... }',
'select' => 'function (event, ui) { ... }'));

One last hint - FireBug (or similar network debugging tool) is your
friend when trying to figure out why your AJAX posts don't return any
results. You can check the "Response" tab for Cake/PHP generated
errors.

Hope this helps!

On Nov 19, 7:06 am, nurvzy  wrote:
> That cookbook link you reference is for the Ajax Helper, not the
> JsHelper.  To my knowledge autocomplete is not supported out of the
> box using the JsHelper.  But it's simple enough to do on your own.
>
> http://docs.jquery.com/UI/Autocomplete
>
> Nick
>
> On Nov 18, 1:09 am, Louie Miranda  wrote:
>
>
>
>
>
>
>
> > I am trying to migrate my autocomplete to JSHelper using JQuery (As the
> > default). And I think there are no documentation or examples yet that has
> > been publicized as of this writing.
>
> > Anyway, I did what the manual has told...
>
> > *Controller:*
> > var $helpers = array('Html', 'Form', 'Time', 'Js' => array('Jquery'));
>
> > *Default.ctp*
> > echo 
> > $html->script('http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js');
> > $this->Js->JqueryEngine->jQueryObject = '$j';
> > print $this->Html->scriptBlock('var $j = jQuery.noConflict();',
> >     array('inline' => false)); //Tell jQuery to go into noconflict mode
>
> > *Now, from autocomplete (under view).*
>
> > *The old code:*
> > autoComplete('q', '/publications/autocompletetitle',
> > array('minChars' => 4, 'class' => 'search')); ?>
>
> > *Was switched to the following:*
> > autoComplete('q', '/publications/autocompletetitle',
> > array('minChars' => 4, 'class' => 'search')); ?>
>
> > And the usual, it did not worked! :(. I turned-on debug and found this error
> > message.
> > *JsHelper:: Missing Method autoComplete is undefined
> > [CORE/cake/libs/view/helpers/js.php, line 154]*
>
> > So, I searched the API for 
> > JSHelper.http://api13.cakephp.org/view_source/js-helper/
>
> > And I did not find the code. The odd thing was actually following the
> > example of the cakephp book for 1.3 for 
> > autocomplete.http://book.cakephp.org/view/1370/autoComplete, and it turned 
> > out wrong.
>
> > Any ideas, how can I make autocomplete work on the new JSHelper? But, if the
> > method does not exist, then it won't make any sense. I think I am missing
> > something here? :(
>
> > Please help.
> > --
> > Louie Miranda
> >  - Email: lmira...@gmail.com
> >  - Web:http://www.louiemiranda.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP 1.3, JSHelper and Autocomplete, Missing method?

2010-11-18 Thread nurvzy
That cookbook link you reference is for the Ajax Helper, not the
JsHelper.  To my knowledge autocomplete is not supported out of the
box using the JsHelper.  But it's simple enough to do on your own.

http://docs.jquery.com/UI/Autocomplete

Nick

On Nov 18, 1:09 am, Louie Miranda  wrote:
> I am trying to migrate my autocomplete to JSHelper using JQuery (As the
> default). And I think there are no documentation or examples yet that has
> been publicized as of this writing.
>
> Anyway, I did what the manual has told...
>
> *Controller:*
> var $helpers = array('Html', 'Form', 'Time', 'Js' => array('Jquery'));
>
> *Default.ctp*
> echo 
> $html->script('http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js');
> $this->Js->JqueryEngine->jQueryObject = '$j';
> print $this->Html->scriptBlock('var $j = jQuery.noConflict();',
>     array('inline' => false)); //Tell jQuery to go into noconflict mode
>
> *Now, from autocomplete (under view).*
>
> *The old code:*
> autoComplete('q', '/publications/autocompletetitle',
> array('minChars' => 4, 'class' => 'search')); ?>
>
> *Was switched to the following:*
> autoComplete('q', '/publications/autocompletetitle',
> array('minChars' => 4, 'class' => 'search')); ?>
>
> And the usual, it did not worked! :(. I turned-on debug and found this error
> message.
> *JsHelper:: Missing Method autoComplete is undefined
> [CORE/cake/libs/view/helpers/js.php, line 154]*
>
> So, I searched the API for 
> JSHelper.http://api13.cakephp.org/view_source/js-helper/
>
> And I did not find the code. The odd thing was actually following the
> example of the cakephp book for 1.3 for 
> autocomplete.http://book.cakephp.org/view/1370/autoComplete, and it turned 
> out wrong.
>
> Any ideas, how can I make autocomplete work on the new JSHelper? But, if the
> method does not exist, then it won't make any sense. I think I am missing
> something here? :(
>
> Please help.
> --
> Louie Miranda
>  - Email: lmira...@gmail.com
>  - Web:http://www.louiemiranda.com

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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