Page 1 of 1

JQDynaNode Expand-property not works?

PostPosted: 04 Apr 2014 10:49
by wieczy123
Hi,

Expand-property in a TIWCGJQDynaTreeNode does not work. It's always false. What can I do?

Thank you.

Best regards

Frank.

Re: JQDynaNode Expand-property not works?

PostPosted: 04 Apr 2014 10:57
by Alexander Bulei
Hi wieczy123,

Please check the documentation:

http://www.cgdevtools.com/docs/_html/IWCGJQDynaTree.TIWCGJQDynaTreeNode.Expand.htm

TIWCGJQDynaTreeNode.Expand - Initial expanded status.

To check the state of node, you need recent version of cgdevtools:

Code: Select all
2.0.0.3489

JQDynaTree
- Added: new methods ExecNodeCommand and "jsNodeCommand"


Documentation:

delphi code
{$IFDEF NODEF}{$REGION 'CGDevTools - Documentation'}{$ENDIF}
/// <summary>
/// Method to execute the command.
/// <note type="note">
/// Only commands:
/// <list type="bullet">
/// <item>
/// dtnActivate
/// </item>
/// <item>
/// dtnDeactivate
/// </item>
/// <item>
/// dtnExpand
/// </item>
/// <item>
/// dtnFocus
/// </item>
/// <item>
/// dtnMakeVisible
/// </item>
/// <item>
/// dtnSelect
/// </item>
/// <item>
/// dtnToggleExpand
/// </item>
/// <item>
/// dtnToggleSelect
/// </item>
/// </list>
/// can be called directly on event (e.g: OnClick).
/// </note>
/// <note type="note">
/// The commands that are not included in the previous note, can only
/// be used in BrowserParams.
/// </note>
/// </summary>
{$IFDEF NODEF}{$ENDREGION}{$ENDIF}
procedure ExecNodeCommand(ACommand: TIWCGJQDynaTreeNodeCommands; const AParams: string = '');
{$IFDEF NODEF}{$REGION 'CGDevTools - Documentation'}{$ENDIF}
/// <summary>
/// Method return javascript code for command.
/// </summary>
{$IFDEF NODEF}{$ENDREGION}{$ENDIF}
function jsNodeCommand(ACommand: TIWCGJQDynaTreeNodeCommands; const AParams: string = ''): string;


since you have this version (or above), you should use the jsNodeCommand in BrowserParams:

delphi code
with IWCGJQButton1.JQButtonOptions.OnClick.BrowserParams.Add do
begin
ServerName:= 'isextanded';
BrowserScript:= IWCGJQDynaTree1.Nodes.Items[1].jsNodeCommand(dtnIsExpanded);
end;


And OnClick event get the param:

delphi code
procedure TIWForm5.IWCGJQButton1JQButtonOptionsClick(Sender: TObject; AParams: TStringList);
begin
WebApplication.ShowMessage(AParams.Values['isextanded']);
end;


Best Regards.

Re: JQDynaNode Expand-property not works?

PostPosted: 10 Apr 2014 13:21
by wieczy123
Thanks :-)

...but it works only on "main-nodes" on "child-nodes" a "VariantTypeCastError" appear. See this c++ code:

TIWCGJQDynaTreeNode *newitem;
TIWCGJQDynaTreeNode *subitem;
String bs;

newitem = IWCGJQDynaTree1->Nodes->Add();
bs = newitem->jsNodeCommand(dtnIsExpanded); // ok.
newitem = IWCGJQDynaTree1->Nodes->Add();
bs = newitem->jsNodeCommand(dtnIsExpanded); // ok.
newitem = IWCGJQDynaTree1->Nodes->Add();
bs = newitem->jsNodeCommand(dtnIsExpanded); // ok.

subitem = newitem->Children->Add();
bs = subitem->jsNodeCommand(dtnIsExpanded); // fail: VariantTypeCastError

What can i do?

Thank you

Frank.

Re: JQDynaNode Expand-property not works?

PostPosted: 10 Apr 2014 13:58
by Alexander Bulei
Hi wieczy123,

Thanks, will fix right now.

Best Regards.

Re: JQDynaNode Expand-property not works?

PostPosted: 10 Apr 2014 14:05
by Alexander Bulei
Fixed in V2.0.0.3516:

Code: Select all
JQDynaTree
- Fixed: Invalid typecast on children nodes (owner)


Best Regards.