This project is read-only.
1
Vote

Enable/Disable LargeItem trough javascript

description

Hi,
I am using OffceWebUi Ribbon in my source code.And in my code there is requirement of disableing an OfficeWebUI:LargeItem throught javascript on Page load.But I am not able to do it.Can any one help.Here is my source code.
 
<Content>
                                                    <OfficeWebUI:LargeItem ID="btnGR" runat="server" ImageUrl="~/Images/add_32.png" Text="Add / <br /> Duplicate" 
                                                        Tooltip="Add New Timespent with selected Row" OnClick="imgbtnadd_Click" />
                                                    <OfficeWebUI:LargeItem ID="imgbtndelete"  runat="server"  ImageUrl="~/Images/delete_32.png"    
                                                        Text="Delete" Tooltip="Delete selected Timespents"  OnClick="imgbtndelete_Click" />
</Content>
 
i need to disable the "imgbtndelete" trough java script on page load.

comments

SamyJonny wrote Nov 16, 2011 at 10:59 AM

Try this :
add disable and enable functions in the Ribbon.js file

// Disable an item
DisableItem: function (itemId, img) {
    var me = $("div[ItemID=" + itemId + "]");

    me[0].className = "RibbonItems RibbonItems_LargeItem Disabled RibbonItemWithTooltip";

    $(me[0].getElementsByTagName("IMG")).attr("src", img);
    $(me[0]).attr('onclick', null).unbind('click');

    //        var src1 = $(me[0].getElementsByTagName("IMG")).attr("src");
    //        var image = me[0].getElementsByTagName("IMG");
},

// Enable an item
EnableItem: function (itemId, img) {
    var me = $("div[ItemID=" + itemId + "]");

    me[0].className = "RibbonItems RibbonItems_LargeItem RibbonItemWithTooltip";

    $(me[0].getElementsByTagName("IMG")).attr("src", img);

    //        var src1 = $(me[0].getElementsByTagName("IMG")).attr("src");
    //        var image = me[0].getElementsByTagName("IMG");
},
then call it in your aspx page to change the button status to disabled :

OfficeWebUI.Ribbon.EnableItem("lMediumItemActiver", "UserControls/_imgs/ico_Activer_16.gif");
OfficeWebUI.Ribbon.DisableItem("lMediumItemDesactiver", "UserControls/_imgs/ico_Desactiver_16_disabled.gif");

wrote Feb 14, 2013 at 9:19 PM