Ok so I'm seeing that there are many posts on this topic, and there is apparently no way to cancel a postback from the client ItemClick or ItemSelected events. Can someone tell me what the reason is for not implementing this feature? Are we using this control in a different way than intended?
I have multiple levels in my data source and I need to only post back on the child nodes. Is this not something that seems logical for this control? So if it's not possible to kill the post from the client... what is a good way to accomplish this logic?
Thanks,
Neil
Hi,
the principle is that a click event can not be canceled. All of our controls follow this and that is why a click event can not be canceled in Explorer bar. I've added a workaround in code to allow this.
After fix 63918 is released next month, you can cancel the event the following way:
function WebExplorerBar1_ItemClick_Client(sender, eventArgs) { ///<summary> /// ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebExplorerBar"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.ExplorerBarEventArgs"></param> eventArgs.get_cancel = function () { return this._cancel; } eventArgs.set_cancel = function (val) { this._cancel = val; } eventArgs.set_cancel(true); }
Lubomir
Guys(And Gals), thanks for the quick reply.
Lubomir, why would you say that all controls cannot be canceled? I am currently using a technique for my WebDataMenu to cancel the menu in the same way that I need it done for the ExplorerBar...
eventArgs.set_cancel(true); -> If ( I'm not a ending child node )
I'm certain that I got this solution off your forums.
Also, I'm unclear about what you're proposing here. Are you stating that the method for canceling the explorer bar posted here will work now, or in an upcoming release? This is the same method that was offered in the post that Tsvetelina linked to and that didn’t work for me.
Let me show a little bit of what I've tried and you can tell me if I'm doing something wrong.
<script type="text/javascript"> function ClientClick(sender, args) { eventArgs.get_cancel = function () { return this._cancel; }
eventArgs.set_cancel = function (val) { this._cancel = val; }
eventArgs.set_cancel(true); }</script>
<ig:WebExplorerBar ID="webReportMenu" runat="server" DataSourceID="SampleDataSource" OnItemClick="ServerClick" GroupExpandBehavior="SingleExpanded" Width="300" StyleSetName="Office2007Black"> <AutoPostBackFlags ItemClick="On" ItemSelected="Off" /> <ClientEvents ItemClick="ClientClick" /> <DataBindings> <ig:ExplorerBarItemBinding DataMember="ReportLevel" TextField="Name"/> <ig:ExplorerBarItemBinding DataMember="ReportCategory" TextField="Name"/> <ig:ExplorerBarItemBinding DataMember="ReportName" TextField="Name"/> </DataBindings></ig:WebExplorerBar>
<asp:XmlDataSource runat="server" DataFile="~/Sample.xml" ID="SampleDataSource" XPath="/Root/ReportLevel" />
Thanks for all of the help.
Yeah,
WebDataMenu was one of the controls that slipped from this principle :) This code fix will work in the upcomming service release, which will go public around end of February.
Wonderful, I'm looking forward to this fix.
Can you tell me why this functionality was not considered at the time? Was this overlooked or left out for a reason. I'm just wondering if I'm using this control properly. It seems to be needed by many developers.
Thanks again Ludomir.