Web Connection
Autocomplete wrapper's Width
Gravatar is a globally recognized avatar based on your email address. Autocomplete wrapper's Width
  Luca
  All
  Jul 29, 2019 @ 12:28am

Dear Rick,
I have WC 6.05
I use wwAutocomplete control and it runs well.
However the wrapper opening after interactive search has about 50% useless blank space (the right portion of wrapper).
Please how to control the width of wrapper?
Thank you very much for support

Gravatar is a globally recognized avatar based on your email address. re: Autocomplete wrapper's Width
  Harvey Mushman
  Luca
  Jul 29, 2019 @ 10:56am

can you provide a bit more information...

what does the data look like for each of the items being returned, are they all trimmed or is this the field width that is showing ?

if it is not the data, then you should be able to find the answer in the style, try right clicking and inspecting the classes that control the list items.

Gravatar is a globally recognized avatar based on your email address. re: Autocomplete wrapper's Width
  Luca
  Harvey Mushman
  Jul 29, 2019 @ 10:44pm

Dear Harvey,
the wrapper has always the same width, also when results are closer.
Strings are trimmed.
This is the code:

**************************************
FUNCTION RicercaFunzionario(m.Parametro)
**************************************
LOCAL m.loSerializer 
WITH this
	SELECT IdFunziona as Value,IdFunziona+" - "+ALLTRIM(Cognome)+" "+ALLTRIM(Nome) as Label ;
	FROM Anagrafica ;
	WHERE ATC(m.Parametro,Cognome)>0 ;
	ORDER BY Cognome ;
	INTO CURSOR qRicerca

	IF _tally = 0
		USE IN qRicerca
	   RETURN null
	ELSE 
		m.loSerializer = CREATEOBJECT("wwJsonSerializer")
		 WITH Response
		 	.ContentType = "application/json"
			.Write(m.loSerializer.Serialize("cursor:qRicerca"))
			.End()
		ENDWITH 
		USE IN qRicerca
	ENDIF
ENDWITH 
ENDFUNC 

This is in the page's Head:

I cannot understand how to have a wrapper windows closer, when I have short strings to display.
Many thanks again for support!

Gravatar is a globally recognized avatar based on your email address. re: Autocomplete wrapper's Width
  Rick Strahl
  Luca
  Jul 30, 2019 @ 05:11am

Most likely your data is padded with blanks??? Try binding to the trimmed data instead.

Gravatar is a globally recognized avatar based on your email address. re: Autocomplete wrapper's Width
  Luca
  Rick Strahl
  Jul 30, 2019 @ 05:23am

Dear Rick,
I do not understand what you mean.
I select trimmed data from table:

Select Alltrim(Nome)+" "+Alltrim(Cognome)

and I see trimmed data going yout from wwJSONSerializer

[{"value":"A014","label":"A014 - Martina Luca","descrizion":"Martina Luca"},{"value":"A340","label":"A340 - Martina Mauro","descrizion":"Martina Mauro"},{"value":"A0X2","label":"A0X2 - Martina Mauro","descrizion":"Martina Mauro"},{"value":"2ZCA","label":"2ZCA - Martina Mauro","descrizion":"Martina Mauro"},{"value":"BG11","label":"BG11 - Martina Luciano","descrizion":"Martina Luciano"},{"value":"A308","label":"A308 - Martina PORTA/PORTA Mauro","descrizion":"Martina PORTA/PORTA Mauro"},{"value":"A0X3","label":"A0X3 - Martina PORTA/PORTA Mauro","descrizion":"Martina PORTA/PORTA Mauro"},{"value":"A001","label":"A001 - Martina/OLD Mauro","descrizion":"Martina/OLD Mauro"},{"value":"A0X1","label":"A0X1 - Martina/OLD Mauro","descrizion":"Martina/OLD Mauro"}]

The wrapper window is too large.

Gravatar is a globally recognized avatar based on your email address. re: Autocomplete wrapper's Width
  Harvey Mushman
  Luca
  Jul 30, 2019 @ 07:36am

In your FUNCTION RicercaFunzionario(m.Parametro) the SELECT statement does not match the sample of the data you show below as having been generated, it is missing the FIELD "descrizion" ? Perhaps that missing field is causing your problem... only a guess!

The clue that suggests the problem is in you code comes from your having said when "the results are closer, the strings are trimmed". To me this suggests there is something that is causing the results to be bloated.

One solution to to step through the code but before doing that, I would look at the data as it returns from the server, see what the browser is receiving at the browser end. In other words, put a break point in the javaScript code. If the results are correct then look at the what is happening in the browser rather that assuming the problem is in the FoxPro code. If the problem is not in the JS or VFP code the answer must lay in the CSS...

Just for fun, perhaps create a test page with very simple code, the WC doc's show a solution that is always a good jumping off place. If the sample code works, grow the sample to answer your need and see where it starts to break.

I don't use this control anymore but this advice should help you debug the problem. Please pose your solution to help others learn from your experience.

Good luck - Best...

Gravatar is a globally recognized avatar based on your email address. re: Autocomplete wrapper's Width
  Luca
  Harvey Mushman
  Jul 30, 2019 @ 08:43am

Dear Harvey,
no problem with the field Descrizion, the wrapper window is too large even if I remove Descrizion from SQL statement.
I solved debugging in browser, the problem was caused from a class in westwind.css file

I changed
width: auto;

Finally the wrapper window is correct.
Many thanks

Gravatar is a globally recognized avatar based on your email address. re: Autocomplete wrapper's Width
  Harvey Mushman
  Luca
  Jul 30, 2019 @ 05:17pm

Interesting... because the width statement is invalid CSS! That property must have a unit of measure like "px" or "em" to be considered valid.

I guess Rick might want to take note of this in the next release.

Gravatar is a globally recognized avatar based on your email address. re: Autocomplete wrapper's Width
  Luca
  Harvey Mushman
  Jul 30, 2019 @ 10:11pm

Thank you again for support.
WC is a basic tool!

© 1996-2024