first call renderjavascript("var="+array, "some unique id");
then call to render the javascript that uses the arraywicket will filter contributions by the "some unique id" and only the first one will be rendered. the second part is caching your db call. you can retrieve the db list and store it in requestcycle's metadata as a request-scoped cache. -igor On Fri, Mar 5, 2010 at 1:44 AM, Wayne Pope <[email protected]> wrote: > Hi, > > I been looking how to solve this and I cannot see a clear way. > > Basically in a given page we have a list of TextField derived classes > that use a JQuery auto complete. > This means for each textfield rendered on the page we render in the > head something like: > > $(document).ready(function(){var data = ['Sitemap', 'vbmbmnvbmn', > 'second', 'communications', 'test', 'Wayne', 'Wireframes', 'fook', > 'business case', 'Logos', 'round 1', 'layout', 'Marketing', 'new one', > 'graphics', 'hot stuff', 'Accounts', 'Template']; > $('#labels390').autocomplete(data, { multiple: true, > multipleSeparator: ', ', scroll: true, scrollHeight: 300 })}) > > $(document).ready(function(){var data = ['Sitemap', 'vbmbmnvbmn', > 'second', 'communications', 'test', 'Wayne', 'Wireframes', 'fook', > 'business case', 'Logos', 'round 1', 'layout', 'Marketing', 'new one', > 'graphics', 'hot stuff', 'Accounts', 'Template']; > $('#labels391').autocomplete(data, { multiple: true, > multipleSeparator: ', ', scroll: true, scrollHeight: 300 })}) > > $(document).ready(function(){var data = ['Sitemap', 'vbmbmnvbmn', > 'second', 'communications', 'test', 'Wayne', 'Wireframes', 'fook', > 'business case', 'Logos', 'round 1', 'layout', 'Marketing', 'new one', > 'graphics', 'hot stuff', 'Accounts', 'Template']; > $('#labels392').autocomplete(data, { multiple: true, > multipleSeparator: ', ', scroll: true, scrollHeight: 300 })}) > > etc.. > > > As you can clearly see this isn't too efficient and I want to set the > data array only once and then attach the autocomplete to the textfield > and the data. > > In the renderhead of the textfield derived class is there anyway to > somehow only render the data part once per request? (this also > massively reduces the db calls to create the list!) > > thanks for any pointers > Wayne > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
