CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

TreeViewItem, href=

by itroeger » 04 Jul 2013 10:19

Hello,
at the moment I am evaluating the TIWCGJQTreeView component
and I wonder if and how it is possible to set the href-value of the TreeNodes.
At the moment it seems that the component sets it to a standard value:
href="http://127.0.0.1:8888/#"

Kind regards
Ingo Tröger
itroeger
 
Posts: 15
Joined: 04 Jul 2013 10:10

by Alexander Bulei » 04 Jul 2013 12:24

Hi itroeger,

Hello,
at the moment I am evaluating the TIWCGJQTreeView component
and I wonder if and how it is possible to set the href-value of the TreeNodes.
At the moment it seems that the component sets it to a standard value:
href="http://127.0.0.1:8888/#"


According to the author of the plugin, you can't set "href" to the node.

What are you trying to do?

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by itroeger » 04 Jul 2013 13:34

Hello,

I want to build a kind of filetree to list
files and folders of a WebDAV-Server. When a user clicks onto
a TreeNode the filelink should be executed to show the file in
MS Word for example. Therefore I need different URLs for every TreeNode.

It seems to be possible to insert an additional href-entry (by using the Caption property)
but that has the side effect that the image of the treeview is shown twice.

Kind regards,
Ingo Tröger
itroeger
 
Posts: 15
Joined: 04 Jul 2013 10:10

by Alexander Bulei » 04 Jul 2013 15:01

Hi itroeger,

We have implemented a new property "UserAttributes" in tree node, which allow to storage the user data in html.
Will be released asap.

Just for information, If you have some knowledge of javascript, you can use the property "Script" in each event, for instance OnSelect.Script.

Example to open the link by javascript:

Code: Select all
 window.location.url = 'http://www.cgdevtools.com';


or open in new window:

Code: Select all
 window.open('http://www.cgdevtools.com');


*EDITED: Available from V1.6.0.2618

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by itroeger » 15 Jul 2013 14:29

Hello cgdevtools,

with the new property UserAttributes it is not possible to insert a
href attribute. I just get the error message that
you can not use reserved word href


Kind regards,
Ingo Tröger
itroeger
 
Posts: 15
Joined: 04 Jul 2013 10:10

by Alexander Bulei » 15 Jul 2013 15:34

Hi itroeger,

Yes, you can't use these attribute as custom.
If you want add and them get your custom attr, you should do something like this:

1.
delphi code
Attribute:= 'myhref'
Value:= 'http://www.cgdevtools.com/';


2. Add browser param to event

delphi code
with JQTV1.JQEvents.OnSelect do
begin
with BrowserParams.Add do
begin
BrowserScript:= JQTV1.JQTreeViewOptions.UIPlugin.jsGetSelected + '.attr("myhref")';
ServerName:= 'HrefValue';
end;
end;


3. Get your user data

delphi code
var
LMyHref: string;
Begin
LMyHref:= AParam.Values['HrefValue'];
end;


Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by itroeger » 16 Jul 2013 08:27

Hi cgdevtools,

I have tried to implement your tips but the value which is returned
for the attribute myhref is "undefined". Is there something I am doing wrong?

Kind regards
Ingo Tröger

Code: Select all
procedure TIWFrameTreeView.ProcessCommand(ACommand: Integer; AParams: TStrings = nil);
var
  aCGUserAttribute: TCGUserAttribute;
  i: integer;
begin
  tvTest.JQTreeViewOptions.UIPlugin.PluginActive:= True;
  tvTest.JQTreeViewOptions.ThemesPlugin.PluginActive:= True;
  tvTest.JQTreeViewOptions.HTMLPlugin.PluginActive:= True;

  for i:=0 to tvTest.TreeNodes.Count-1 do
   begin
     aCGUserAttribute:= tvTest.TreeNodes[i].UserAttributes.Add;
     aCGUserAttribute.Attribute:= 'myhref';
     aCGUserAttribute.Value:= 'http://www.dmt.de';
   end;

  with tvTest.JQEvents.OnSelect do
   begin
    with BrowserParams.Add do
     begin
      BrowserScript:= tvTest.JQTreeViewOptions.UIPlugin.jsGetSelected + '.attr("myhref")';
      ServerName:= 'HrefValue';
     end;
   end;
end;

procedure TIWFrameTreeView.tvTestJQEventsSelect(Sender: TObject;
  AParams: TStringList);
var
  LMyHref: string;
begin
  LMyHref:= AParams.Values['HrefValue'];

  ShowMessage(LMyHref);
end;
itroeger
 
Posts: 15
Joined: 04 Jul 2013 10:10


Return to JQTreeView

Who is online

Users browsing this forum: No registered users and 2 guests

Contact Us.