Hi,
i m using WebDataMenu when binding some images to DataMenuItem when i click on DataMenuItem where Key="Add" it is firing below mentioned java script code but oItem.Key is giving undefined. how to get the oItem.Key value in the below javascript code ?
<ig:WebDataMenu ID="WDM" height="22px" itemspacing="0" itemwidthdefault="25px" tabindex="0" runat="server" OnItemClick="WDM_ItemClick" Width="100%"> <AutoPostBackFlags ItemClick="On" /> <GroupSettings Orientation="Horizontal" /> <ClientEvents ItemClick="WDMEditToolbarButtonClicked" /> <ItemSettings CssClass="ItemCssClass" SelectedCssClass="ItemSelectedCSS" HoverCssClass="ItemHoverCSS" /> <Items><ig:DataMenuItem ImageUrl=".new.gif" Key="Add"></ig:DataMenuItem> <ig:DataMenuItem ImageUrl="edit.gif" Key="Edit"></ig:DataMenuItem> <ig:DataMenuItem ImageUrl="copy.gif" Key="Copy"></ig:DataMenuItem> <ig:DataMenuItem ImageUrl="delete.gif" Key="Delete"></ig:DataMenuItem> </Items>
</ig:WebDataMenu>
JavaScript Code:-
function WDMEditToolbarButtonClicked(oToolBar, oItem, oEvent) { if(oItem.Key == "Add")
{ alert(oItem.Key); }
}
Hello Ravi,
Thank you for contacting Infragistics community.
What version of IG controls are you using, because the event parameters of ItemClick client-side event that you're defining are not available in the new WebDateMenu control's ItemClick event. The WebDataMenu's ItemClick event accepts only two parameters: sender and event arguments. I'm attaching a sample with similar scenario for your reference. If you have further questions, please let me know.
Regards,
Tsanna
Hi Tsanna,
I m using Infragistics v14.2 Version=14.2.20142.1028 .
Thanks for sample solution, using sample solution i am able to fix my issues.
thanks
Ravi
Please note that set_enabled() method is accessible through the respective item's object, which means that you can use it like following:
eventArgs.getItem().set_enabled(false)
If you need further assistance, feel free to contact me.
Hi Tasanna,
Thanks for reply, when try use below code
it is saying "Undefined" .
i m attaching a working sample please find the attachment and let me know what might be alternative way to achieve this.
Thanks
The fact that calling set_enabled() method returns 'undefined' doesn't mean that it does not execute properly. In fact this is method that does not return a specific type of result at that point therefore it returns undefined, however it works properly though.
If you have any other questions, please let me know.
Thanks for reply, i have one more question regarding WebDataMenu .
In Ultrawebtoolbar we had oItem.DefaultImage = "../Images/DownArrow.jpg"; in webdatamenu how to use default image property
In Ultrawebtoolbar code :-
function ToolbarButtonClicked(oToolBar, oItem, oEvent) {
if(oItem.Key == "New")
{ oItem.DefaultImage = "../Images/New.jpg";}
else{ oItem.DefaultImage = "../Images/Edit.jpg"; }
what will be equivalent in webdatamenu for above code ?
Can you reply for above post.
Thanks for the help, this issues has been resolved for now.
Regrads
Hi Ravi,
Can I help with something else?