For this reason I am using the auto complete jQuery UI provides:

In the view:

<script type="text/javascript">
$(document).ready(function(){

  $(function() {
    $("#no_table_computedName").autocomplete({
      source: "{{=URL('jqueryui', 'elementnode_autocomplete')}}",
      minLength: 2
    });
  });
  
});
</script>

In a controller which I called jqueryui.py

def elementnode_autocomplete():
    
rows=db((db.node.computedSubClass==SC_ORGANIZATION)&(db.node.computedName.like(request.vars.term+'%')))\
    
.select(db.node.computedName,distinct=True,orderby=db.node.computedName).as_list()
    result=[r['computedName']for r in rows]
    return response.json(result)


Using Bootstrap's typeahead might also be an option.

Kind regards,

Annet

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to