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

expand event for TreeList fires before the expand ajax request is completed

9 Answers 77 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
maxharn
Top achievements
Rank 1
maxharn asked on 21 Apr 2015, 10:36 AM
If the TreeList branch expand loads remote data, the expand event triggers before the ajax request is completed. Is there any reason for that or it's just a bug?
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
commented on 26 Jan 2022, 09:37 AM

Is there another way to get an after expand event. The tree that I have loads all the nodes but they should not be expanded by default. So the databound event is not triggered after expand. I need to make some buttons disabled on the row
Georgi Denchev
Telerik team
commented on 27 Jan 2022, 02:12 PM

Hello, Dan,

I'll share the response from the ticket here as well, in case anybody else has the same question. In order to emulate an "afterExpand" and "afterCollapse" events, you can use setTimeout to delay the execution of the logic.

expand: function() {
  setTimeout(function(){
    // Custom code here will be executed after the row has been expanded.
  });
}

Best Regards,

Georgi

9 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 23 Apr 2015, 06:28 AM

Hello Ivo,

 

This behavior is intended, see the quote from the event documentation: "Fired when an item is about to be expanded."

 

The reason for this is that the event can be prevented.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
maxharn
Top achievements
Rank 1
answered on 24 Apr 2015, 07:59 AM
Is there somewhere an example how to bind to an "on-after-expand" event?
0
Nikolay Rusev
Telerik team
answered on 28 Apr 2015, 07:10 AM

Hello Ivo,

The following example demonstrates a way to achieve this - http://dojo.telerik.com/@rusev/EGUTI

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
maxharn
Top achievements
Rank 1
answered on 02 Jul 2015, 12:17 PM

Thank you very much.

 But I also found, that, "expanded" event is triggered only by clicking on the "expand" icon. TreeList.expand() function does not trigger the event. Is this also intentional or a bug and is there a work around?

 The fact is that when I click - the example above work. When call TreeList.expand() - it does not.

 regs

Ivo

0
Nikolay Rusev
Telerik team
answered on 03 Jul 2015, 10:40 AM

Hello Ivo,

 

Yes, the API method will not trigger the event. You should be able to execute the logic for checking model state right after you call expand API.

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
maxharn
Top achievements
Rank 1
answered on 03 Jul 2015, 12:59 PM

Unfortunately this is not the case, as I want to select (again with an api method) a row that is in the newly loaded with the expand rows. And of course they load asynchr. I found a workaround with the DataBound event... but its a dirty workaround :)

I saw in some other posts that there was a similar case with Menu expand event which was considered a bug. Would this also be considered as a bug and be fixed soon?

 Thanks

0
Nikolay Rusev
Telerik team
answered on 07 Jul 2015, 10:36 AM

Hello Ivo,

 

I'm not sure I fully understand the scenario which you described. Can you please simulate it in the dojo example from my previous posts?

 

 

 

Regards,
Nikolay Rusev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Mark
Top achievements
Rank 1
answered on 19 Aug 2015, 07:27 PM
Is there an activate event for Treelist?
0
Dimo
Telerik team
answered on 24 Aug 2015, 06:27 AM
Hello Mark,

There is no "activate" event exposed by the TreeList. In case you want to find out when an item has been expaded, use the approach provided above that attaches a one-time dataBound handler when an item is about to be expanded.

http://dojo.telerik.com/@rusev/EGUTI

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeList
Asked by
maxharn
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
maxharn
Top achievements
Rank 1
Mark
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or