[Cubicweb] AutoCompletion

Florent Cayré florent at secondweb.fr
Wed Feb 17 15:06:50 CET 2010


badly named. You fetch the complete rset, but you can use the 'q' and
'limit' parameters that jquery autocomplete adds in the request form to
build your rset.
Simple example to query cities :

@monkeypatch(basecontrollers.JSonController)
@basecontrollers.jsonize
def js_city_autocomplete(self):
    limit = max(1, min(int(self._cw.form['limit']), 100))
    limit_rql = " LIMIT %s " % limit
    q = self._cw.form['q'].replace('"', '\"')
    rql = ('Any C,Z+" "+N  ORDERBY N%sWHERE C is City, C name N, C zipcode
Z, '
           'C zipcode ilike "%s%%" or C name ilike "%s%%"' % (limit_rql, q,
q))
    return self.req.execute(rql).rows


2010/2/17 Aurélien Campeas <aurelien.campeas at logilab.fr>

> Le mercredi 17 février 2010 à 09:06 +0100, Florent Cayré a écrit :
> > Hi all,
> >
> > regarding partial rset fetching, Katia did the job, we just used it
> > and checked it was working ok with the 3.6 version, which it does.
>
> partial rset fetching ? I like the sound of it. Can we see it ?
>
>


-- 
Ce message est la propriété de SecondWeb et peut contenir des informations
confidentielles. Si vous n'êtes pas le destinataire désigné, nous vous
remercions de bien vouloir nous en aviser immédiatement et de nous retourner
ce message ou de le détruire, sans faire un quelconque usage de son contenu,
ni le communiquer ou le diffuser, ni en prendre copie, électronique ou non.

This message is the property of SecondWeb and may contain confidential
information. If you are not the designated recipient, please notify us
immediately and return the message to us or destroy it, without making any
use whatsoever of the contents thereof. Furthermore you should not forward
or copy the message by electronic or other means.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20100217/a9c7d069/attachment-0002.html>


More information about the Cubicweb mailing list