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

determine itemtype client-side

1 Answer 49 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Albert Shenker asked on 18 Oct 2009, 05:44 PM
I need to loop through the items in my toolbar client-side and set some specific properties if the item is a button and based upon it's "Group" property. When  I Ioop through, how do I first determine if the item is a RadToolbarButton (and therefore has the get_group method available? There doesn't seem to be a get_ItemType client-side method.

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 21 Oct 2009, 08:40 AM
Hi Albert,

Please use the following javasctipt code in order to find the type of the button:

function getItemType(button) {
    var type;
    var className = button.get_element().className;
    if (className.indexOf("rtbBtn") >= 0)
        type = "button";
    else if (className.indexOf("rtbDropDown") >= 0)
        type = "dropdown";
    else
        type = "splitbutton";
    return type;
}

you can use it like this:

var toolbar = $find("<%=RadToolBar1.ClientID %>");
var type = getItemType(toolbar.get_items().getItem(0));

Regards,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ToolBar
Asked by
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Answers by
Yana
Telerik team
Share this question
or