Delete Option in Header

3 posts, 1 answers
  1. Marc
    Marc avatar
    133 posts
    Member since:
    Sep 2016

    Posted 05 Jan Link to this post

    I'm trying to add a delete option in the header of the dropdownlist.

     

    $scope.layoutOptions = {

     headerTemplate: '<div data-ng-if="selectedLayout.id < 0" class="dropdown-header k-widget k-header"><a href="" data-ng-click="deleteLayout(instance)">Delete    {{selectedLayout.description}}?</a></div>'

    }

    This are my options (inside an AngularJs controller). Is there any way to pass the selected value (dataItem) to my function deleteLayout?

  2. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3717 posts

    Posted 09 Jan Link to this post

    Hello Marc,

    As the widget's header is static, it doesn't have any knowledge which item is focused/selected and the moment of button click. The best solution in this case will be to get the selected item from the widget using its API:

    $scope.deleteLayout = function() {
      //$scope.ddl is a reference to the Kendo UI DropDownList
     
      var selectedDataItem = $scope.ddl.dataItem(); //use it to delete the same instance from the datasource
    }

    Regards,
    Georgi Krustev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Marc
    Marc avatar
    133 posts
    Member since:
    Sep 2016

    Posted 09 Jan in reply to Georgi Krustev Link to this post

    Hi Georgi,

    This is exactly what I was looking for! Thanks!

    Marc

Back to Top