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

Disable ToolBarButton - TopandBottom CommandItemDisplay

1 Answer 9 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 13 Oct 2016, 04:18 PM

I have a RadToolBar in the CommandItemTemplate of a RadGrid.  I would like to (client-side) disable a button upon row click.  On row click I loop through the tool bar's items and disable the button I want.  This works but only disables the button on the top of the grid.  The command items at the bottom of the grid are left alone.  How can I disable both the top and bottom button?

 

function grdViewToolRecords_RowClicked(sender, args) {
    var toolBar = $telerik.findControl(sender.get_element(), "rtbViewToolRecords");
    var toolBarItems = toolBar.get_allItems();
 
    var i = 0;
 
    while (i < toolBarItems.length) {
        if (toolBarItems[i].get_text() == "Check Out") {
            toolBarItems[i].disable();
        }
 
        i++;
    }
 
    toolBar.commitChanges();
}

1 Answer, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 18 Oct 2016, 01:18 PM
Hello Keith,

You should access both of the CommandItems to achieve this requirement. For example:
$.each($(sender.get_element()).find(".rgCommandRow"), function (i, el) {
    var control = $telerik.findControl(el, "RadButton1");
    alert(control.get_id());
});

I hope this will prove helpful.

Regards,
Eyup
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
ToolBar
Asked by
Keith
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or