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

Change toolbar items using $scope

8 Answers 130 Views
Toolbar
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 15 Apr 2015, 09:49 PM

Hi,

 

I'm trying to change some toolbar items at runtime by updating the options held in $scope.

The attached file in Index.zip uses an older version of Kendo and works fine (the modal window title and button text on the 2nd toolbar button get updated as I'm trying to do).

When I change to use the current version of Kendo with the following CSS/JS files, as shown in the attached file IndexBad.js.zip, it blows up with the following error:

Error: [ng:areq] http://errors.angularjs.org/1.3.0/ng/areq?p0=MyCtrl&p1=not%20a%20function%2C%20got%20undefined
    at Error (native)
    at http://cdn.kendostatic.com/2015.1.408/js/angular.min.js:6:416
    at Mb (http://cdn.kendostatic.com/2015.1.408/js/angular.min.js:19:510)
    at nb (http://cdn.kendostatic.com/2015.1.408/js/angular.min.js:20:78)
    at $get (http://cdn.kendostatic.com/2015.1.408/js/angular.min.js:74:494)
    at http://cdn.kendostatic.com/2015.1.408/js/angular.min.js:56:415
    at r (http://cdn.kendostatic.com/2015.1.408/js/angular.min.js:7:408)
    at M (http://cdn.kendostatic.com/2015.1.408/js/angular.min.js:56:281)
    at g (http://cdn.kendostatic.com/2015.1.408/js/angular.min.js:51:201)
    at g (http://cdn.kendostatic.com/2015.1.408/js/angular.min.js:51:218)

FYI, I've tried the broken version with jQuery from both the Kendo and jQuery CDNs, both throw the same error.

Is this a bug, or has some behavior changed? If it's a change, what is the correct way to do this in the updated version of Kendo?

Thanks,

Chris Csencsits

8 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 17 Apr 2015, 08:39 AM

Hello Chris,

I have tried to reproduce the issue in the following sample, but to no avail. Can you please check it out and let me know what I missed:

http://dojo.telerik.com/IzOWu

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Chris
Top achievements
Rank 1
answered on 17 Apr 2015, 01:28 PM

Hi,

 Your sample is different from what I submitted.

In my code, the toolbar is in a modal window that is opened by another event on the page after the page loads:

<div id="example" ng-app="KendoDemos">
<div class="demo-section k-header" ng-controller="MyCtrl">
<div kendo-button ng-click="openWindow();">Open</div>
<div kendo-window="pricelookupwin" k-options="pricelookupwinoptions">
<div kendo-toolbar k-options="pricelookupinfooptions" k-rebind="pricelookupinfooptions"></div>
</div>
</div>
</div>

The pages opens with just one button, when the user clicks it, the modal window opens and the toolbar in the window is updated with some changes.

In the older versions of kendo it runs fine. 

In the current version of kendo the button doesn't even render and I'm getting a JavaScript error in the jQuery library.

I replaced the code in the example in the link with the code I've attached and it doesn't run.

I took the time to create a self-contained sample to show the problem and I've attached it again - have you tried running what I sent in the original post?

Thank you,

Chris Csencsits

0
Kiril Nikolov
Telerik team
answered on 21 Apr 2015, 08:56 AM

Hello Chris,

The example that you submitted is not a runnable one. So please edit the one that I created in order to show the issue in a runnable sample and we will be happy to investigate.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Chris
Top achievements
Rank 1
answered on 21 Apr 2015, 02:26 PM

Hi Kiril,

I've modified your example as requested and attached the updated code, and tested it on the dojo.telerik.com site and it should run now.

In the example, the user clicks a button to open a modal window which contains the toolbar. I want to change the window title and the toolbar items when the window opens based on other data.

In the attached sample, the window title gets updated, but the toolbar doesn't, and I'm seeing the following error in the browser console when the window opens:

TypeError: Cannot read property 'get' of undefined
    at Object.fn (kendo.all.min.js:54)
    at h.$get.h.$digest (angular.min.js:120)
    at h.$get.h.$apply (angular.min.js:123)
    at HTMLDivElement.<anonymous> (angular.min.js:224)
    at HTMLDivElement.b.event.dispatch (jquery.min.js:3)
    at HTMLDivElement.b.event.add.v.handle (jquery.min.js:3) 

The only thing I can see that's different in my example is that the toolbar is inside the modal window instead of being on the main page.

Thanks for any help you can provide.

Chris Csencsits

 

 

 

 

 

0
Chris
Top achievements
Rank 1
answered on 22 Apr 2015, 02:15 PM

Hi Kiril,

 I've been able to come up with a better example.

 In this one, there are two copies of the toolbar that share the same options: one on the main page and one in the modal popup window.

 The toolbar on the main page updates as expected.

The toolbar on the modal popup window does not get updated, but the title for the modal popup window does get updated.

Let me know if this one works to show the issue.

Chris Csencsits

0
Kiril Nikolov
Telerik team
answered on 23 Apr 2015, 02:22 PM

Hello Chris,

The problem comes from the fact that you need to set the app on the body in order to keep the window inside the application. Please check it out here:

http://dojo.telerik.com/ojEqE

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Chris
Top achievements
Rank 1
answered on 23 Apr 2015, 02:59 PM

Kiril,

 Thank you! That was the obvious piece I wasn't seeing.

 Chris Csencsits

0
Kiril Nikolov
Telerik team
answered on 23 Apr 2015, 03:26 PM

Hello Chris,

Happy to help.

In case something else comes up - do not hesitate to contact us.

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
Chris
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Chris
Top achievements
Rank 1
Share this question
or