I went back to a project from about 6 month ago, where i added a JQAutoComplete to a Form.
With your help i get it working.
Added code:
- Code: Select all
BrowerParam:= IWCGJQAutoComplete.JQAutoCompleteOptions.OnSelect.BrowserParams.Add;
BrowerParam.ServerName:= 'myuid';
BrowerParam.BrowserScript:= 'ui.item.uid';
The Json is filled
- Code: Select all
for i := 0 to BaseDataCache.UserList.Count -1 do
begin
if pos(Uppercase(ATerm),Uppercase(BaseDataCache.UserList[i])) > 0 then
begin
ItemJSon:= SO();
if (Copy(BaseDataCache.UserList[i], Pos('[IM3]', BaseDataCache.UserList[i]) + 5, 1)= '-') then
LLabel := Copy(BaseDataCache.UserList[i], 1, Pos('[IM1]', BaseDataCache.UserList[i]) - 1)
else
LLabel := Copy(BaseDataCache.UserList[i], 1, Pos('[IM1]',BaseDataCache.UserList[i]) - 1) + ' (' +
Copy(BaseDataCache.UserList[i], Pos('[IM3]', BaseDataCache.UserList[i]) + 5, Length(BaseDataCache.UserList[i])) + ')';
LValue := Copy(BaseDataCache.UserList[i], Pos('[IM1]',BaseDataCache.UserList[i]) + 5, Length(BaseDataCache.UserList[i]));
ItemJSon.S['value']:= LValue;
ItemJSon.S['label']:= LLabel;
AJSon.AsArray.Add(ItemJSon);
end;
end;
What happens?
If i start typing a see a correct list of choises based on what i have typed.
However if i select one the Show text in the component is not the name but the Value set above
the code
- Code: Select all
procedure TFrmMainAdmin.IWCGJQAutoCompleteJQAutoCompleteOptionsSelect(
Sender: TObject; AParams: TStringList);
begin
UserSession.IMSession.UserInfo := Aparams.Values['myuid'];
ShowFrame(1000);
end;
Aparams.Values['myuid']; = 'Undefined'
I added this form to a new project. The old one is still working ok, so i'm missing something, but what?
Any help appreciated
Eric