python +谷歌应用程序引擎中的自动完成文本框示例

时间:2021-09-24 03:14:40

For my google app engine application, I need to include a autocompleter Textbox which will show the name starting with the textbox value.And the name will retrieve from the google app engine datastore.

对于我的谷歌应用程序引擎应用程序,我需要包含一个autocompleter文本框,它将显示以文本框值开头的名称。名称将从谷歌应用程序引擎数据存储中检索。

Any good tutorial or sample code please.

任何好的教程或示例代码请。

Update: Please Answer for this

更新:请回答这个问题

I created a sample HTML code : dl.dropbox.com/u/7384181/autocomplete/autocomplete.html . In this html page i have creating the textbox dinamically.So currently i assign the autocomplete in the first textbox(txtProduct1) only. How do i assign the autocomplete in rest all the textbox which is going to create dynamically ?

我创建了一个示例HTML代码:dl.dropbox.com/u/7384181/autocomplete/autocomplete.html。在这个html页面中,我创建了一个文本框。因此,目前我只在第一个文本框(txtProduct1)中分配自动完成。如何在rest中分配自动补全所有要动态创建的文本框?

3 个解决方案

#1


8  

You can have a look at the jquery auto complete here

您可以在这里查看jquery自动完成

HTML :

HTML:

$("#search_users").autocomplete(/search/search_manager);

python-controller:

python-controller:

jquery autocomplete plugin by default uses variable q

jquery自动完成插件默认使用变量q

class search_user(webapp.RequestHandler):
            q = (self.request.GET['q']).lower() 
            results=models.user.all().fetch(100) 
            for records in result:
                print records+"|"+records+"\n"

application = webapp.WSGIApplication([
                                      (r'/user_auth/search_manager',search_user)]

def main():
  run_wsgi_app(application)

if __name__ == '__main__':
  main()

simple:

Apply the autocomplete to a class $

将自动补全应用到类$

(".search_users").autocomplete(/search/search_manager);

#2


2  

Look into JQuery's autocomplete plugin, you can use a django template tag to populate the data. Below is an example if your data is separated by commas.

查看JQuery的自动完成插件,您可以使用django模板标记填充数据。下面是一个用逗号分隔数据的示例。

Python:

Python:

names=[name for name in db.GqlQuery("SELECT * FROM names")]
values={'names':','.join(names)}
self.response.out.write(template.render('template.html',values))

template.html:

template.html:

var data = "{{names}}".split(",");
$("#example").autocomplete(data);

#3


0  

Using autocomplete with GAE Python and YUI3 AutoComplete Plugin.

使用自动完成与GAE Python和YUI3自动完成插件。

#1


8  

You can have a look at the jquery auto complete here

您可以在这里查看jquery自动完成

HTML :

HTML:

$("#search_users").autocomplete(/search/search_manager);

python-controller:

python-controller:

jquery autocomplete plugin by default uses variable q

jquery自动完成插件默认使用变量q

class search_user(webapp.RequestHandler):
            q = (self.request.GET['q']).lower() 
            results=models.user.all().fetch(100) 
            for records in result:
                print records+"|"+records+"\n"

application = webapp.WSGIApplication([
                                      (r'/user_auth/search_manager',search_user)]

def main():
  run_wsgi_app(application)

if __name__ == '__main__':
  main()

simple:

Apply the autocomplete to a class $

将自动补全应用到类$

(".search_users").autocomplete(/search/search_manager);

#2


2  

Look into JQuery's autocomplete plugin, you can use a django template tag to populate the data. Below is an example if your data is separated by commas.

查看JQuery的自动完成插件,您可以使用django模板标记填充数据。下面是一个用逗号分隔数据的示例。

Python:

Python:

names=[name for name in db.GqlQuery("SELECT * FROM names")]
values={'names':','.join(names)}
self.response.out.write(template.render('template.html',values))

template.html:

template.html:

var data = "{{names}}".split(",");
$("#example").autocomplete(data);

#3


0  

Using autocomplete with GAE Python and YUI3 AutoComplete Plugin.

使用自动完成与GAE Python和YUI3自动完成插件。