Alver R.
Posts: 5
Joined: 2012-01-11
|
I have a toggle button and another buttons, the buttons are disabled by default. I want to enable them if the first button is toggled. Can you give me an example please? |
|
Dmitry Kostochko
Add-in Express team
Posts: 2875
Joined: 2004-04-05
|
Hi Alver,
In JavaScript, you can use the same names that you set to your controls in Visual Studio and almost the same properties and methods. Please have a look at the code sample below:
SPRibbonProject4.Features.SPRibbon1.SPRibbon1.prototype.adxspRibbonToggleButton1OnClick_EventHandler = function (sender) {
// sender is ADXSPRibbonToggleButton
if (sender.Pressed) {
this.adxspRibbonButton1.Enabled = true;
this.adxspRibbonButton2.Enabled = true;
this.adxspRibbonButton3.Enabled = true;
}
else {
this.adxspRibbonButton1.Enabled = false;
this.adxspRibbonButton2.Enabled = false;
this.adxspRibbonButton3.Enabled = false;
}
// refresh UI
this.RefreshRibbon();
}
This is the OnClick event handler of an ADXSPRibbonToggleButton control. The code enables or disables 3 additional buttons (named adxspRibbonButton1, adxspRibbonButton2 and adxspRibbonButton3 in my case) depending on the Pressed property. Additionally, the RefreshRibbon method is called to refresh controls.
You can find more details about objects, their properties and methods that can be accessed in JavaScript in the "The Ribbon Designer JavaScript client object model" chapter of the Ribbon Designer Class Reference. |
|