Update Toolbar Items when options change on $scope

2 posts, 0 answers
  1. Gaja
    Gaja avatar
    12 posts
    Member since:
    Oct 2007

    Posted 27 Aug 2014 Link to this post

    With regards to this example : http://demos.telerik.com/kendo-ui/toolbar/angularIs 

    Is it possible to update $scope.toolbarOptions at runtime and have the items on the toolbar update as well?

    I cant seem to find a solution for this in your API reference. Is this feature expected anytime soon? There isn't even a way to complete empty the toolbar and repopulate the items again. 

    There dont seem to be many methods you can call on the toolbar too. How about some Hide() & Show() methods?

    Also is it possible to use a button on the toolbar and define a ng-click event on it? Currently we are doing this by giving a template with a href tag and ng-click on it.
  2. Kiril Nikolov
    Kiril Nikolov avatar
    2596 posts

    Posted 28 Aug 2014 Link to this post

    Hello Gaja,

    As we are already discussing the same topic in the support thread that you created, I will copy my answer here as well:

    You can indeed change the toolbar options on runtime using angular. For example if you want to change the second button text you can use:

    Copy Code
    $scope.toolbarOptions.items[1].text = "Test"

    If you want to empty the toolbar you just need to empty the items array. If you want to attach a click event handler to a Toolbar button, you can use a template with ng-click attribute, like in this example that I prepared:

    In case you need to change options runtime you will need to call the k-rebind attribute as shown in this example


    Kiril Nikolov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top