kendo.destroy() not working

6 posts, 0 answers
  1. Madreza
    Madreza avatar
    3 posts
    Member since:
    Jun 2016

    Posted 22 Jun Link to this post

    when i remove an dom element all effect still exist in kendo, and kendo try to get injector of those removed elements that i removed.
    how can i destroy them to stop kendo for get the injector of them.
    the function of kendo is setupRebind
    and here is my code:

     

    function removeAllChildren(level) {
        if (vm.dataLevel.length > vm.currentSender + 1) {
     
            for (var i = vm.dataLevel.length - 1; i > vm.currentSender; i--) {
                var idToRemove = "#level" + i + "";
                var idCss = "#data-level-" + i + "";
                var selectedData = angular.element(idCss).data("kendoDropDownList");
                kendo.unbind(angular.element(idCss));
                kendo.unbind(angular.element(idToRemove));
                selectedData.destroy();
                angular.element(document.querySelector(idToRemove)).remove();
            }
            vm.dataLevel.splice(vm.currentSender + 1);
            vm.currentElement = "#level" + vm.currentSender + "";
        }
    }

     

    but after this, i traced and i saw that my idToRemove elements still exist in kendo and kendo want to access them via this line

     

    var compile = element.injector().get('$compile');
    widget._destroy();

     

    my app works very good but i have error for every removed element.
    Error:

     

    TypeError: Cannot read property 'get' of undefined
    at http://localhost:46255/Scripts/kendo.all.js:118139:53
    at Scope.$digest (http://localhost:46255/scripts/angular.js:17073:23)
    at http://localhost:46255/scripts/angular.js:17268:26
    at completeOutstandingRequest (http://localhost:46255/scripts/angular.js:5869:10)
    at http://localhost:46255/scripts/angular.js:6145:7

     

    please help me :(

  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 24 Jun Link to this post

    Hello,

    Could you send us a repro demo that demonstrates the issue? This will help us to perform a more detailed investigation and find the cause of the erroneous behavior.

    Regards,
    Georgi Krustev
    Telerik
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
  4. Madreza
    Madreza avatar
    3 posts
    Member since:
    Jun 2016

    Posted 24 Jun in reply to Georgi Krustev Link to this post

    i can give you all of my controller and html codes, when we create an kendo directive, its works good but when we remove it, the injector is undefined but kendo try to use it with a get function.

    thanks for reply

  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 29 Jun Link to this post

    Hello Madreza,

    Thank you for the attached files. I reviewed the implementation and at first glance everything is correct. In order to continue with the investigation, would it be possible to send us a runnable demo which replicates the issue? You can try our Dojo service to create a runnable demo. This will help us a lot to observe the issue and find a solution much faster.

    Regards,
    Georgi Krustev
    Telerik
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  6. Madreza
    Madreza avatar
    3 posts
    Member since:
    Jun 2016

    Posted 30 Jun in reply to Georgi Krustev Link to this post

    Hello Georgi,

    Thank you for reply.

    please at first clear my attached code, secondly my problem solved. i think its a bug, because my codes works very well when i clear dataSource but i get a undefined error when i use destroy method.

     

    now my code is:

    selectedData.setDataSource([]);
    //selectedData.destroy();
    angular.element(document.querySelector(idToRemove)).remove();

     

  7. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 30 Jun Link to this post

    Hello Madreza,

    Indeed, the exception thrown on widget.destroy() call is a peculiar problem. We would like to address it, but to do that we will need an isolated example that replicates the issue. This will gives us a foundation to start our investigation. Would it be possible to provide such repro demo?

    Regards,
    Georgi Krustev
    Telerik
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
Back to Top
Kendo UI is VS 2017 Ready