Expand a node and two treeviews open - kendo-ui

I have two kendo treeview.
When I do a drag and drop an item on an other, I duplicate the item. (no node is removed on drop)
treeright.append(itemSource, itemDestinationKitem);
and it's work fine.
When I click on item (just be drop) the node opens, BUT the itemSource too !
Thx

I found a way around the problem.
By duplicating items kendo ui widget does not regenerate new uid , so to expand a mirror effect occurs.
To solve this problem I SET again the datasource of treeview with call ajax the second treeview and new uid will be affected.
To be in the same state :
I just add persistence on items to keep the state of the nodes 'expand' before loading. This kendo link help me.

Related

How can I "take control" of selecting TreeView items?

If you have a TreeView in a VS Code extension, when you click on the items in it, they get selected (highlighted green, in my color theme). Click away from them and they get un-highlighted. See the below screenshot, in the file explorer view:
I'd like to "take control" of this behavior. I want to disable the highlighting that happens by default when the user clicks on these items, disable the un-highlighting that happens when they click away, and control in my extension code when the items get highlighted. I'd like to do this in my extension's custom TreeView, not an existing one.
Use the 'reveal' method of the treeview item. You can specify if it's to be 'selected' and also 'focused'.
Basically, you can change to the structure you want by forcing a refresh of the whole treeview. You probably already know that if you started making treeview extensions for vscode...
But then, right as it finishes re-rendering the tree, you 'reveal' a node, with the 'select' parameter option, to have that node as the selection in the tree. ...To have another node selected, just 'reveal' another one. (no need to force a full refresh of the treeview if it's only to have another node selected without changing the structure of the tree.)
see the 'reveal' method of the treeview here treeview API
Also see the leointeg extension on vscode for actual code example of controlling which node is selected

Kendo ListView and MVVM 'edit template' cancel button resets bound data to initial state

I have a Kendo ListView bound to an Observable object and all is working well.
I'm able to:
Add items to the list
Edit existing items by using the edit template below
Delete items
One oddity though is when I switch an item to edit view and click Cancel it resets all data back to the original data. So if I started with one item with say name and amount fields, I edit the item and change the amount, then add two more items to the list all is well. But then I click edit on any of the items and immediately click cancel, from here it removes all the additional items I added and resets the data for the first item back to what it was at the beginning.
Why would the cancel action do that?
This dojo snippet shows the exact problem I'm having: http://dojo.telerik.com/IKowo
Kendo version 2016.3.1118
EDIT:
One further development, I found a forum post on Telerik stating that you have to have an ID column and a schema:model:id setup otherwise things won't work as expected.
I've updated the dojo snippet as follows: http://dojo.telerik.com/IKowo/2
Since adding the ID to the mix it looks like the amounts aren't being affected by the cancel button but the newly added items still get removed.
Follow the example provided here by telerik
//Binding Listview to local data array & Perform CRUD
http://dojo.telerik.com/eWih/2
The Only Requirement for the cancel event not deleting the new Items is:
The id field should be kept 0 when adding the new item to the datasource
It should be incremented / Updated in the datasource transport.create event (REQUIRED)
happy coding!

Issue with Kendo MVVM Cascading drop down

I am working on developing a cascading drop down with Kendo MVVM. The issue is that when the drop down loads the child drop down initially displays "undefined". This disappears though when I select some data in the parent drop down.
Alternatively I also require a Reset button in place. On click of this button I need to reset the cascade so that we get back to the initial phase(i.e. the child drop down should be disabled and no data should be selected in the parent).
Please find a JSBin that I created for the issue here
Thanks in advance for the help.
You should be using IDs as values, not strings. I think you can play around with data-primitive-value but why? Just use proper structure to begin with. For the clear, just dropdownlist.select(0) or dropdownlist.select("") if you managed to make it work with the primitive value thing.
http://dojo.telerik.com/ePIDO

Selecting checkbox in Kendo UI Treeview

I am using Kendo UI tree view with checkboxes. My problem is when i am loading the tree i will be checking some checkboxes using javascript. But this is not selecting parent checkbox automatically. Do i need to do this manually or is there any option in the framework.
Thanks,
Raja
Lets assume that you want to select the node that is selected:
// Get the node that is selected
var selected = treeview.select();
// Find the checkbox associated with this node
var checkbox = $("input[type='checkbox']", selected)[0];
// Click on it for selecting it and its ancestors
checkbox.click();
Being treeview the result of creating kendoTreeView:
var treeview = $("#my_tree").kendoTreeView({...}).data("kendoTreeView");
If you check the nodes by adding the 'checked' attribute with JavaScript
e.g.
$('input').attr('checked','checked')
you will need to handle the parent checking manually. However if you simulate click the TreeView will update its state as it would do if you have used the mouse to click.
e.g.
$('input').click();
Keep in mind you need to call the click on the checkbox input not the span element wrapping it.
Kendo ui (html5) treeview the position is reset to the begining of the tree.
when i bind the many records in the tree . when i select the last node the treeview position is reset to the begining of the tree.
This problem arises only in IE(Internet Explorer 9). in firefox and chrome it is working fine .
The image 1 shows the page that treeview reset to begining of the tree after selecting the tree node at the last record.
the image 2 shows the page that treeview node is selected at the botom

Treeview - highlighting multiple items

In Powerbuilder, Does anyone here know how am i going to highlights multiple items on a treeview? Selecteditem function is not doing that. Im looking for a behavior just what Selectedrow id doing.
Thanks!
I've not tried this myself but there is an example on CodeXchange (look for Multi-select TreeView Control).
I think the treeview style datawindow might be easier to do this with.
If not, I found this on the newsgroup, don't know if it helps:
The following script in the
selectionchanged event will implement
a very basic multiselect in the
treeview:
treeviewitem ltvi_item
if KeyDown(KeyControl!) then
This.GetItem(oldhandle, ltvi_Item)
ltvi_Item.Selected = True
This.SetItem(oldhandle, ltvi_Item)
end if
A problem is deselecting the
previously selected items. You would
have to scan through ALL items do look
for the selected ones (once the user
clicks an item without holding down
the control key)
https://groups.google.com/forum/#!msg/powersoft.public.powerbuilder.objects/B2ulHBrSnrs/itwhNBjlyOoJ
One approach to this is to use the CheckBoxes attribute on the treeview, then check the treeviewitem's StatePicture (Unchecked = 1, Checked = 2).
Good luck,
Terry.

Resources