This is a migrated thread and some comments may be shown as answers.

RequestStart event: how to get html element

2 Answers 443 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Dino
Top achievements
Rank 1
Dino asked on 05 Nov 2012, 04:18 PM
Hello,

I am currently migrating from Telerik MVC, and I haven't found the answer for my problem in the migration documents. 

I have a treeview which originally used the OnDataBinding event, which I have now mapped to the RequestStart event of the datasource. Now, in my javascript handler, i originally had something simliar:

onDataBinding: function(e) {
e.preventDefault();
var div = $(e.target).closest(MyDivSelector); ... } Since originally it was a jquery event object, i was able to check the e.target for the html element of the sender. However, with Kendo events, I don't find anything similar (inside e.sender). What can I use to get the html element of the sender?

2 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 08 Nov 2012, 04:29 PM
Hi Dino,

 
Basically the RequestStart event returns the DataSource object in the e.sender and you should select the TreeView by it's index:

$("#treeview").closest(MyDivSelector)

 Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Dino
Top achievements
Rank 1
answered on 08 Nov 2012, 04:38 PM
Unfortunately, that isn't an option in our case since this code is found in a generic control (partial view), and there can be multiple instances. It was nice with Telerik since we knew when we were databinding, which treeview it was.  We were able to use the same method for all cases, and use the event arguments to determine which control was doing the databinding.

Either way, i found a workaround where i go through all these type of controls on the page, compare their treeview datasource instances, and find the one that matches e.sender.
Tags
TreeView
Asked by
Dino
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Dino
Top achievements
Rank 1
Share this question
or