>>The pain with the pingoworks autocomplete is
>>that only complete words with a 'start-with' match...

This is done on the server. The pingoworks plugin just sends whatever
is in the text input to the server.  Just change this:
>>return "\n".join([f for f in states if 
>>f.lower().startswith(request.vars.q.lower())])
...to this...
>>return "\n".join([f for f in states if request.vars.q.lower() in f.lower())])

>>inp = SQLFORM.widgets.string.widget(f,v, **attr)  ¿add to widgets form a 
>>widget string function?
This builds the textbox.  Using the SQLFORM widget and passing
f,v,**attr guarantees that the input will have the default value that
comes out of the db and  necessary attributes to pass validation.

>>scr1 = SCRIPT("jQuery('#%s').autocomplete('%s');" % 
>>(inp['_id'],items_url),_type="text/javascript") ¿generate script substituting 
>>the form widget and the items?
This applies the autocomplete to inp.  We are getting the id from the
input with inp['_id'].  You can get any attribute this way.

>>wrapper.components.extend([inp,scr1]) (i got lost here at all :D)
Components are just a list.  Extend is a standard list function that
just adds a list to a list.  It is a shortcut for saying
wrapper.components.append(inp), wrapper.components.append(scr1).

I am going to modify the slice to not use a plugin, but just use raw
jQuery. I'll post when it's done.



On Nov 4, 5:03 am, Alex Fanjul <[email protected]> wrote:
> The pain with the pingoworks autocomplete is that only complete words
> with a 'start-with' match, not a completed match, so you for example
> could find "New York" searching for 'New' but not searching for 'York',
> the same with surnames, etc.
> One day I was searching such a kind of autocomplete for jquery and I
> couldnt find it...
>
> Over all code I hardly understand this 3 lines, could you vaguely
> explain these...
>
> |     inp = SQLFORM.widgets.string.widget(f,v, **attr)  ¿add to widgets form 
> a widget string function?
>      scr1 = SCRIPT("jQuery('#%s').autocomplete('%s');" % 
> (inp['_id'],items_url),_type="text/javascript") ¿generate script substituting 
> the form widget and the items?
>      wrapper.components.extend([inp,scr1]) (i got lost here at all :D)
> |
>
> Thanks Mr.freeze,
> Alex F
>
> El 03/11/2009 23:06, mr.freeze escribió:
>
>
>
> > I have a cheesy autocomplete widget here. It's no match for the
> > facebook version but might help someone:
>
> >http://www.web2pyslices.com/main/slices/take_slice/24
>
> > On Nov 3, 11:24 am, Alex Fanjul<[email protected]>  wrote:
>
> >> I love this kind of widget!!! maybe your next challene would be the so
> >> famous "facebook-autocomplete".
> >> Nowdays in facebook there is also a new feature where you can appoint a
> >> "friend" writting "@friend" as twitter did it, but with autocompleter...
>
> >> By the way Mr. Freeze, I think we should talk with someone who proposed
> >> and was working on a wrapper framework por jquery widgets...
> >> I cant find the email.... She proposed us 3 options to choose for
> >> implementation...
>
> >> Alex F
>
> >> El 03/11/2009 7:06, mr.freeze escribió:
>
> >>> Nothing like a slice of web2py before bedtime :) I'm going widget
> >>> crazy! Here's an in-place edit widget that presents your text as a
> >>> SPAN until you double click then it changes into an input.
>
> >>>http://www.web2pyslices.com/main/slices/take_slice/23
>
> >>> On Nov 3, 12:01 am, mdipierro<[email protected]>    wrote:
>
> >>>> These slices taste excellent!
>
> >>>> On Nov 2, 11:56 pm, "mr.freeze"<[email protected]>    wrote:
>
> >>>>> Thanks, I updated it to specify adding to the model or controller.
>
> >>>>> On Nov 2, 11:33 pm, mdipierro<[email protected]>    wrote:
>
> >>>>>> Thank you Mr Freeze.
>
> >>>>>> One comment. I do not think people should edit web2py_ajax.html.
>
> >>>>>> response.files.append should go in plugin models or controller of the
> >>>>>> plugin; or the<scrip...>    should go directly in the views.
>
> >>>>>> Massimo
>
> >>>>>> On Nov 2, 10:48 pm, "mr.freeze"<[email protected]>    wrote:
>
> >>>>>>> Here are two ready to use widgets that employ the jQueryUI slider and
> >>>>>>> datepicker:
>
> >>>>>>> slider -http://www.web2pyslices.com/main/slices/take_slice/20
> >>>>>>> datepicker -http://www.web2pyslices.com/main/slices/take_slice/22
>
> >>>>>>> Have fun!
>
> >> --
> >> Alejandro Fanjul Fdez.
> >> [email protected]
>
> --
> Alejandro Fanjul Fdez.
> [email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to