CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

OnClick problem

by DelphiStudent » 02 Jun 2018 03:00

Hello.

I have CG version 3.5.0.231 on DXE10 14.1.14.

Am using IWCGJQVertMenu, and I am creating the items dinamically (reading from database).
the items have sub items, almost for 3 or 4 levels.

basically, the creation of the items are something like this

var
dtnItem : TIWCGJQVertMenuItem;
begin
...

dtnItem := IWCGJQVMDocumentos.Items.Add;
dtnItem.Tag := ServerController.UserSession.CDS_DataMyId.AsInteger;
dtnItem.Caption := ServerController.UserSession.CDS_DataMyText.asString;
dtnItem.Picture.Picture.Url := '/Files/Iconos16/Folder.png';


//and for subitems I locate the Item and later...

dtnItem := dtnItem.SubItems.Add;

well...
the problem is that I detected that the property UniqueName is ReadOnly. (for example on DynaTree the property UniqueName for nodes are not ReadOnly).
so, I noticed that the new Items on VertMenu had the property uniquename like this (for example)

IWCGJQVMDOCUMENTOSIWCGJQFRAME1EXPLORADOR3_0_8_0_0
IWCGJQVMDOCUMENTOSIWCGJQFRAME1EXPLORADOR3_0_9_0_0
IWCGJQVMDOCUMENTOSIWCGJQFRAME1EXPLORADOR3_0_8_1_0
IWCGJQVMDOCUMENTOSIWCGJQFRAME1EXPLORADOR3_0_8_2_0


and later at the event IWCGJQVMDocumentosJQVertMenuOptionsClick I tried to get the name of the Item clicked, with this code

var
item : TIWCGJQVertMenuItem;
iCodigoDocumentoVersion : Integer;
sNombreItem : String;
begin
item := nil;
sNombreItem := AParams.Values['itemId'];
item := IWCGJQVMDocumentos.Items.ItemsByUniqueName[sNombreItem ];

if (item <> nil) then
begin
WebApplication.ShowMessage( item.Caption);
end;

well, here is the real problem, the AParams.Values['itemId'] return names of the clicked Item like this

IWCGJQVMDOCUMENTOSFRAME_0
IWCGJQVMDOCUMENTOSFRAME_0_0
IWCGJQVMDOCUMENTOSFRAME_0_8_0_0

that is not found and item is always nil.

take in mind that a uniquename
IWCGJQVMDOCUMENTOSIWCGJQFRAME1EXPLORADOR3_0_8_0_0
is very different than
IWCGJQVMDOCUMENTOSFRAME_0_8_0_0

why IwCgJQVertMenu behaviours this way???


at the moment , my solution was trying to fit the real uniquename, but I dont feel that's the correct solution.

what can you say??
DelphiStudent
 
Posts: 11
Joined: 15 May 2017 21:45

by Jorge Sousa » 04 Jun 2018 14:29

hi

Use VertMenu.Items.GetByUniqueName
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to JQVertMenu

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.