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

How to set a ToolBarButton image sprite on the client

1 Answer 86 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Tom asked on 14 Nov 2016, 05:31 PM

How do I go about setting a ToolBarButton image sprite on the client side? I want to change the sprite css class depending on user action.

On the server side, I successfully set the sprite for the buttons "Option1" and "Option2" in my toolbar "rtbarLs" like this:

RadToolBarButton rtbb1 = (RadToolBarButton)rtbarLs.FindItemByValue("Option1");
rtbb1.SpriteCssClass = "spriteCheck";
rtbb1.EnableImageSprite = true;
RadToolBarButton rtbb2 = (RadToolBarButton)rtbarLs.FindItemByValue("Option2");
rtbb2.SpriteCssClass = "spriteBlank";
rtbb2.EnableImageSprite = true;

 

On the client side, I tried this:

var rtbarSumm = window.$find("<%= rtbarLs.ClientID %>");
rtbarSumm.findItemByValue('Option2').set_spriteCssClass("spriteCheck");

 

but the spriteCssClass for ToolBarButton "Option2" is still "spriteBlank". Note that there is no JavaScript error reported in the debugger console.

Thoughts?

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 16 Nov 2016, 01:36 PM
Hi Tom,

The set_spriteCssClass() method is inherited from the RadToolBarItem object, but the sprite's CssClass is not updated when calling the method, because currently there is no related implementation. In other words the method is just a placeholder, this is why there is no javascript error when calling it, but there is no actual functionality implemented for this method. For that reason it is not listed in the RadToolBarButton methods section of the documentation. The set_spriteCssClass() method is not an exception, there are other placeholder methods that are not listed in the documentation, because they haven't been implemented yet, for instance set_disabledCssClass().

Regards,
Ivan Danchev
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.
Tags
ToolBar
Asked by
Tom
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or