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

Update Toolbar Items when options change on $scope

1 Answer 125 Views
Toolbar
This is a migrated thread and some comments may be shown as answers.
Gaja
Top achievements
Rank 1
Gaja asked on 27 Aug 2014, 11:48 AM
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.

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 28 Aug 2014, 11:01 AM
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:
 
http://dojo.telerik.com/uDUC

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

http://dojo.telerik.com/uDUC/3

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Toolbar
Asked by
Gaja
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or