Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Template support for the treeView #177

Closed
alexgrefu opened this issue Feb 1, 2014 · 7 comments
Closed

Template support for the treeView #177

alexgrefu opened this issue Feb 1, 2014 · 7 comments

Comments

@alexgrefu
Copy link

Hi,

Please see the following plunker: http://plnkr.co/edit/JiEr6FMropwTmLaODk9Q?p=preview

I'm trying to mess with template support for the treeview without much success. The tree item template seems to be passing through angular, but the recursive nature of the tree items is somehow messing with the compile phase. (click on the plus button and you'll see that the scope function is called multiple times). The reason appears to be that an item gets compiled multiple times, so I think that we can't follow the same approach as the grid. Any solution / suggestion?

Another thing that I noticed is that the databound event is fired multiple times, even if I set the loadOnDemand = false. Do you have any idea why? Also, the tree does not fires a databinding event. Without it what could be a good place to destroy the items scope?

Thank you in advance.

@mishoo mishoo closed this as completed in d5adf49 Feb 2, 2014
@mishoo
Copy link
Contributor

mishoo commented Feb 2, 2014

I worked around it: http://plnkr.co/edit/xSbpg3WhCqQl0JhWJUpI?p=preview

@alexgrefu
Copy link
Author

Brilliant! Thank you very much!

One problem that still seems to remain is the drag & drop clue. You can see this if you try to drag a node around in the original plunker. It seems that treeview.templates.dragClue is responsabile for this, but I believe this is an internal kendo api. Any clues?

@alexgrefu
Copy link
Author

One workaround I have found is to set the drag clue using a kendo template:

widget.templates.dragClue = kendo.template("#: data.item.text #");

The only thing is that I have no idea where to set this (doesn't seems to work if I put it in the options on the scope)

p.s: the html that needs to be passed to the template:

<div class='k-header k-drag-clue'><span class='k-icon k-drag-status' />#: data.item.text #</div>

Cheers

@mishoo
Copy link
Contributor

mishoo commented Feb 2, 2014

One problem that still seems to remain is the drag & drop clue. You can see this if you try to drag a node around in the original plunker.

D'n'D seems to work — what exactly is the problem?

@alexgrefu
Copy link
Author

You lose the compiled content of the item (on the drag hint). Please see the attached screen shot

kendo_tree_drag_clue

@mishoo
Copy link
Contributor

mishoo commented Feb 2, 2014

Ah, right, I didn't even notice it. :-)

You are right, the dragClue template is not officially customizable, but I think your hack to set it in widget.templates.dragClue is okay. I'll try to figure out if there's a better way. Reopening this for now.

@mishoo mishoo reopened this Feb 2, 2014
@mishoo mishoo closed this as completed in c0b2b72 Feb 3, 2014
@alexgrefu
Copy link
Author

You're the man! Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants