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

Disabling button in client-side script

4 Answers 163 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Andrej
Top achievements
Rank 1
Andrej asked on 04 May 2011, 04:35 PM
Hello there

I am trying to disable button in ribbon bar in client-side script. After building pretty complex script to get reference to button item I called set_enabled(false) and nothing happened. I think problem is in set_enabled function in:
set_enabled: function (c) {
		if (this._element) {
			return;
		} if (c) {
			b(this._element).attr("disabled""disabled");
		} else {
			b(this._element).removeAttr("disabled");
		}
	}

if this._element is set, return is called. I think it should be opossite. Or am I doing something wrong?
I was able to disable the button with hard-code hacks in js. But disabled image is not used.

Another problem is that when I disable button even from server-side, button text looks like disabled and
button frame is not shown. But I am still able to click the button and I am redirected to '#'.





BTW:




How can I easily find reference to button item in js?

Thank you very much.

Kind regards
Andrej

4 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 09 May 2011, 04:44 PM
Hello Andrej,

Thank you for reporting the problem with set_enabled method - I have logged it and as soon as we fix the issue, we will notify you in this same thread. Your telerik points are updated.

"How can I easily find reference to button item in js?"
 - You can use the findItemByText method on the RibbonBar client-side object representation.


Regards,
Nikolay Tsenkov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Andrej
Top achievements
Rank 1
answered on 10 May 2011, 06:54 AM
Thanks Nikolay.

"How can I easily find reference to button item in js?"
- You can use the findItemByText method on the RibbonBar client-side object representation.

Problem is that Text is translated in our solution. So I am looking for way how to identify the button with some internal constant id. Is there some solution for this? If not, it would maybe be good idea for future release.

Regards
Andrej
0
Nikolay Tsenkov
Telerik team
answered on 12 May 2011, 02:38 PM
Hello Andrej,

We are planning on implementing CommandName property on the action items (items that can trigger an event for example click). There you will be able to assign the additional identification for your items. FindItemByCommandName method will be provided additionally so you can use the property for searching.


Regards,
Nikolay Tsenkov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Andrej
Top achievements
Rank 1
answered on 12 May 2011, 05:07 PM
That sounds great. Thank you very much.
Tags
RibbonBar
Asked by
Andrej
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Andrej
Top achievements
Rank 1
Share this question
or