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

SplitButton by Value equivalent?

1 Answer 37 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Joshua
Top achievements
Rank 1
Joshua asked on 19 Dec 2011, 11:12 PM
In javascript, I'm using .findButtonByValue('value').

However, how do I find a split button, especially since there's no 'value' property of the SplitButton?

Thanks,
Joshua

1 Answer, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 20 Dec 2011, 12:08 PM
Hi Joshua,

To get the split button, you can use the following approach:

1. Set a custom attribute to the SplitButton. For example:

<telerik:RibbonBarSplitButton SplitButtonValue="SplitButton1" Size="Medium" Text="Button" ImageUrl="~/Img.jpg" />

2. Now you can find the button with the following function:
function findSplitButton(buttonValue){
    var ribbon = $find("RadRibbonBar1");
    for (var i = 0; i < ribbon.get_tabs().get_count(); i++) {
        var tab =  ribbon.get_tabs().getTab(i);
        for (var j = 0; j < tab.get_groups().get_count(); j++) {
            var group = tab.get_groups().getGroup(j)
            for (var k = 0; k < group.get_items().get_count(); k++) {
                var item = group.get_items().getItem(k);
                var customAttribute = item.get_element().getAttribute('SplitButtonValue')
                if(customAttribute != null && customAttribute == buttonValue){
                    alert(item.get_text());
                }
            }
        }
    }
}


Regards,
Bozhidar
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
RibbonBar
Asked by
Joshua
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
Share this question
or