Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
410
Changing ImageUrl property on client side
posted

Hello,

I am using a WebExplorerBar and I would like to change the ImageUrl property on the client side whenever an ItemClick event occurs.
Unfortunately, I don't find the adequate Client API method to change the ImageUrl (if it exists), can you indicate me how to do this?

I was expecting to do something like in the JS code below, but unfortunately this "set_imageurl" function does not seem to exist. What shoud I be doing?

<code>
...
 <ig:WebExplorerBar ID="WebExplorerBar1" GroupExpandBehavior="SingleExpanded" runat="server" Height="300px" Width="250px">
    <DataBindings>
      <ig:ExplorerBarItemBinding DataMember="RootMenuItem" TextField="Text" />
      <ig:ExplorerBarItemBinding DataMember="MenuItem" DefaultText=" " TextField="Text" ValueField="MenuItemIsSelected" TargetField="_blank" ToolTipField="Text" ImageUrlField="ImageUrl" />
    </DataBindings>
      <ClientEvents ItemClick="WebExplorerBar1_ItemClick" />
</ig:WebExplorerBar>

 

<script id="igClientScript" type="text/javascript">
<!--

function WebExplorerBar1_ItemClick(sender, eventArgs)
{
 ///<summary>
 ///
 ///</summary>
 ///<param name="sender" type="Infragistics.Web.UI.WebExplorerBar"></param>
 ///<param name="eventArgs" type="Infragistics.Web.UI.ExplorerBarEventArgs"></param>

 //Add code to handle your event here.
 var selectedItem = eventArgs.getExplorerBarItem();
 selectedItem.set_imageurl("../Images/NewIcon.gif");
 return;
 
 
}///

</code>

Any hint will be very much appreciated,
G.

 

Parents
No Data
Reply
  • 8160
    Suggested Answer
    posted

    Hello greale ,

    this should be working:

     function WebExplorerBar1_ItemClick(sender, eventArgs) {
                var explorerBar = $find('<%= WebExplorerBar1.ClientID %>');
                var selectedItem = explorerBar.get_selectedItem();
                if ((selectedItem.get_parentItem()._node) != null) {
                    eventArgs.getExplorerBarItem().get_element(0).childNodes(0).childNodes(0).setAttribute("src", "./rss_icon.gif");
                }
            }
    ...
    <ig:WebExplorerBar ID="WebExplorerBar1" GroupExpandBehavior="SingleExpanded" runat="server"
                Height="300px" Width="250px" GroupContentsHeight="">
                <ClientEvents ItemClick="WebExplorerBar1_ItemClick" />
                <Groups>
                    <ig:ExplorerBarGroup GroupContentsHeight="" Text="Group">
                        <Items>
                            <ig:ExplorerBarItem Text="Item" ImageUrl="./icon1.gif">
                            </ig:ExplorerBarItem>
                            <ig:ExplorerBarItem Text="Item" ImageUrl="./icon1.gif">
                            </ig:ExplorerBarItem>
                        </Items>
                    </ig:ExplorerBarGroup>
                </Groups>
                <DataBindings>
                    <ig:ExplorerBarItemBinding DataMember="RootMenuItem" TextField="Text" />
                    <ig:ExplorerBarItemBinding DataMember="MenuItem" DefaultText=" " TextField="Text"
                        ValueField="MenuItemIsSelected" TargetField="_blank" ToolTipField="Text" ImageUrlField="ImageUrl" />
                </DataBindings>
            </ig:WebExplorerBar>
    I Hope that this is going to help you

     

Children
No Data