number of visible entries in an autocomplete list

93 views
Skip to first unread message

django boonman

unread,
Jan 25, 2012, 9:19:13 AM1/25/12
to Qubit Toolkit Developers
hi guys,

is it possible to increase the number of visible entries (default 10)
in an autocomplete list?

Jesús García Crespo

unread,
Jan 25, 2012, 3:11:59 PM1/25/12
to qubi...@googlegroups.com
Hi Django,

On Wed, Jan 25, 2012 at 6:19 AM, django boonman <dja...@ejbdesignery.nl> wrote:
is it possible to increase the number of visible entries (default 10)
in an autocomplete list?

Yes! There are two settings involved:

1) js/autocomplete.js - Where the YAHOO.widget.AutoComplete class is instantiated, you should be able to increase the maximum number of results (maxResultsDisplayed).

2) autocompleteAction.class.php - Look at the first lines of code in the execute method:

if (!isset($request->limit))
{
  $request->limit = sfConfig::get('app_hits_per_page');
}

You may want to create a new Qubit setting just for the number of results in autocomplete widgets. It makes sense to me since hits_per_page (default value 10) is used for searches.

Regards,
 
--
Jesús García Crespo,
Software Engineer, Artefactual Systems Inc.
http://www.artefactual.com | +1.604.527.2056

django boonman

unread,
Jan 26, 2012, 4:54:08 AM1/26/12
to Qubit Toolkit Developers
I found it, the number of visible entries in the autocomplete lists is
set in the /vendor/yui/autocomplete/autocomplete.js file. But make
sure to change it also in the autocomplete-min.js file because the
autocomplete-min.js file is the one that is actually used by Ica-AtoM.

Regards,
Django Boonman

On Jan 25, 9:11 pm, Jesús García Crespo <je...@artefactual.com> wrote:
> Hi Django,
>
> On Wed, Jan 25, 2012 at 6:19 AM, django boonman <dja...@ejbdesignery.nl>wrote:
>
> > is it possible to increase the number of visible entries (default 10)
> > in an autocomplete list?
>
> Yes! There are two settings involved:
>
> 1) js/autocomplete.js - Where the YAHOO.widget.AutoComplete class is
> instantiated, you should be able to increase the maximum number of results (
> maxResultsDisplayed<http://developer.yahoo.com/yui/docs/YAHOO.widget.AutoComplete.html#pr...>
> ).

Jesús García Crespo

unread,
Jan 26, 2012, 12:24:53 PM1/26/12
to qubi...@googlegroups.com
Hi Django,

On Thu, Jan 26, 2012 at 1:54 AM, django boonman <dja...@ejbdesignery.nl> wrote:
I found it, the number of visible entries in the autocomplete lists is
set in the /vendor/yui/autocomplete/autocomplete.js file. But make
sure to change it also in the autocomplete-min.js file because the
autocomplete-min.js file is the one that is actually used by Ica-AtoM.

I am sorry but that what you are saying is very wrong. The vendor files are not intended to be modified.

If you want to redefine the default value for the property maxResultsDisplayed, you should do that in our project file js/autocomplete.js.

In this example I set the value to 12345:

Index: js/autocomplete.js
===================================================================
--- js/autocomplete.js  (revision 10587)
+++ js/autocomplete.js  (working copy)
@@ -167,6 +167,9 @@
                   autoComplete.minQueryLength = 0;
 
+                  // ...
+                  autoComplete.maxResultsDisplayed = 12345;
+
                   // Give user chance to type something, one second may still
                   // be too little,

Jesús García Crespo

unread,
Jun 7, 2012, 2:12:33 PM6/7/12
to Incógnito, qubit-dev
Hi there!

The problem was that the limit was harcoded in the action code. I have done a few fixes that will help you:


Regards,

On Thu, Jun 7, 2012 at 9:07 AM, Incógnito <master...@gmail.com> wrote:
Hi Jesus,

I read the whole thread and I couldnt get it to work. I need to change
the max results of subjectAccessPoints, placeAccessPoints and
nameAccessPoints, all of them showed in this URL: /index.php/;add/isad

I added a line in js/autocomplete.js, exactly at the same place where
you added it in your example. I configured it to multiple values (e.g.
20), all of them > 10.

I configured the nine "autocompleteAction.class.php" files I've found,
replacing "$request->limit = sfConfig::get('app_hits_per_page');" by,
e.g.,  "$request->limit = 20 ". I already know it's not necesary to
change all of them, but I did it anyway.

I even tried changing the original file "/vendor/yui/autocomplete/
autocomplete-min.js":
YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed = 20;

I also changed "global_settings_hits_per_page" to 20... but... got
nothing but 10 results.

I deleted the cache a thousend times, I refreshed my browser time and
time again and... I'm still getting 10 results top. I'm my database I
have much more "places", "subjects" and "names" than 10...

Thanks for your help.


On Jan 26, 7:24 pm, Jesús García Crespo <je...@artefactual.com> wrote:
> Hi Django,
>
> On Thu, Jan 26, 2012 at 1:54 AM, django boonman <dja...@ejbdesignery.nl>
>
>  wrote:
> > I found it, the number of visible entries in the autocomplete lists is
> > set in the /vendor/yui/autocomplete/autocomplete.js file. But make
> > sure to change it also in the autocomplete-min.js file because the
> > autocomplete-min.js file is the one that is actually used by Ica-AtoM.
>
> I am sorry but that what you are saying is very wrong. The vendor files are
> not intended to be modified.
>
> If you want to redefine the default value for the property
> maxResultsDisplayed, you should do that in our project file
> js/autocomplete.js.
>
> In this example I set the value to 12345:
>
> Index: js/autocomplete.js
> ===================================================================
> --- js/autocomplete.js  (revision 10587)
> +++ js/autocomplete.js  (working copy)
> @@ -167,6 +167,9 @@

>                    autoComplete.minQueryLength = 0;
>
> +                  // ...
> +                  autoComplete.maxResultsDisplayed = 12345;
> +
>                    // Give user chance to type something, one second may
> still
>                    // be too little,

>
> --
> Jesús García Crespo,
> Software Engineer, Artefactual Systems Inc.http://www.artefactual.com| +1.604.527.2056

Incógnito

unread,
Jun 7, 2012, 6:26:28 PM6/7/12
to Qubit Toolkit Developers
Great fix! Sure it works! Thank you!



On Jun 7, 8:12 pm, Jesús García Crespo <je...@artefactual.com> wrote:
> Hi there!
>
> The problem was that the limit was harcoded in the action code. I have done
> a few fixes that will help you:
>
> http://code.google.com/p/qubit-toolkit/source/detail?r=11746http://code.google.com/p/qubit-toolkit/source/detail?r=11747
Reply all
Reply to author
Forward
0 new messages