简体   繁体   中英

Kendo TreeList Bindings Do Not Persist On Row Edit

I have a treelist and I need icons in the rows, but I also need the rows to be editable. I have put together an example of a strange error I am getting here.

http://dojo.telerik.com/OyaB/10

In the sixth column you can see an icon, it is bound to an event but if you edit the row and update it the binding is lost, so I added a new bind event on save and this causes a very strange error telling me 'Uncaught TypeError: Cannot read property 'unbind' of undefined', which I do not quite understand. Do you guys have any ideas why this is happening or is this just a bug because the tree list is a new feature? Thanks in advance.

since the binding is a click to a function delegate you can try to bind using the on() function from jquery.

$("#treelist").on('click', 'span#uploadSpec', function () {
     alert("Stuff");
});

I believe then the bind is persisted as it is held by the treelist then when trigger filtered to a particular element in the cell ('span#uploadSpec').

After that you can work around finding the dataitem etc using:

var treelist = $("#treelist").data().kendoTreeList;
var dataItem = treelist.dataItem($(this).closest('tr'));
OpenPdfForEmployeeByEmployeeId(dataItem.EmployeeId);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM