Zicrael / ngx-tree-dnd

Angular 7 support, data sortable draggable smart tree.
https://ngx-tree-dnd.stackblitz.io
MIT License
39 stars 11 forks source link

How can I call an event when edit button is clicked? #16

Closed kapilpundit closed 5 years ago

kapilpundit commented 5 years ago

I see you have provided (onrenameitem) event, which triggers once the user has updated the node in the tree and clicked on the check mark.

But, can we have an event when the edit button is clicked, because I would like to open a new page when we click on edit button. Thanks.

Zicrael commented 5 years ago

Hello @kapilpundit ! Yes, you right, at the moment you can do this, but its good idea, I implement it today. Stay in touch. Thank you for smart issue.

Zicrael commented 5 years ago

Hey @kapilpundit good news for you! I update package to 2.4.1 version. Now you able to trigger onStartRenameItem() and onFinishRenameItem() update package by run npm install ngx-tree-dnd

Zicrael commented 5 years ago

@kapilpundit please let me know if new version help in you issue. If its help you can close it, also you can star project;)

kapilpundit commented 5 years ago

Hi Zicrael,

I have upgraded to 2.4.1 and here's my html code:

<lib-ngx-tree-component [treeData]='categoryTree' [config]='config' (onstartrenameitem)="onStartRenameItem($event)"></lib-ngx-tree-component>

Here's component method: onStartRenameItem(event) { console.log('rename'); }

But still I am not able to get the event to trigger.

Thanks,

Zicrael commented 5 years ago

I change type of this things to camel case ( likeThisOne ) so type: (onStartRenameItem)="onStartRenameItem($event)" instead (onstartrenameitem)="onStartRenameItem($event)" . At the moment only onStartRenameItem and onFinishRename item in camel case , but notice in funure versioins i change them all to camelCase.

kapilpundit commented 5 years ago

@Zicrael I had tried that also, but it didn't work. Do I have to add / change something in config?

Zicrael commented 5 years ago

@kapilpundit You have latest version? Check in stackblitz, updated demo. It is work fine. Please check it now https://stackblitz.com/edit/ngx-tree-dnd Is props in you code simillar?

kapilpundit commented 5 years ago

@Zicrael yes I have copied your latest code from https://stackblitz.com/edit/ngx-tree-dnd and I see it working there. I am not able to do it on my system. My browser version is also latest. i dont know what could be the problem..

kapilpundit commented 5 years ago

@Zicrael Yes, its working now. It was some cashing issue on our server. Thanks a lot for your support. Really nice library.

kapilpundit commented 5 years ago

I am closing the issue now.

Zicrael commented 5 years ago

@kapilpundit thank you for good works;) have a good day, also if you like it star it ;)

kapilpundit commented 5 years ago

Sure I will star it :)