Monthly Archives: February 2013

Solution: eventArgs.get_type() incorrectly detects header of WebDataGrid in FireFox as cell

If you use CSOM of Infragistics WebDataGrid you may encounter a bug in client-side event handlers. Let’s say some action is needed on double clicking of a grid cell. The handler looks something like this:

function xMyGrid_DoubleClick(sender, eventArgs) {
   if (eventArgs.get_type() == "cell") {
      //perform action
   }
}

IF condition on line 2 makes sure that action is executed only if actual grid cell is double clicked. If you double click column header, eventArgs.get_type() would return "header" and the action would be skipped.

But not in FireFox. In that browser eventArgs.get_type() returns "cell" even when header is clicked. So an additional condition is needed. Grid column header is rendered as a TH HTML element and this is what we can check:

function xMyGrid_DoubleClick(sender, eventArgs) {
   if (eventArgs.get_type() == "cell" &&  eventArgs.get_item().get_element().tagName != 'TH') {
      //perform action
   }
}

This solution works universally in all browsers.

ABCMouse.com contact number is 800-633-3331

ABCMouse.com offers teaching games for kids. Some like them, some don’t – it’s a matter of taste and preference. What really sucks about the site is their contacts – they never respond to emails, and online contact form isn’t of much use either. And nowhere on the site they list phone number for a contact.

Fortunately such number does exist:

1-800-633-3331

And when you call it, surprisingly, you get to speak to a live person, who resolves your problems pretty quickly.


DISCLAIMER

I feel really silly posting this disclaimer, but due to numerous comments here it is: I am in no way associated with ABCMouse.com. I myself had a bad experience with their service and when I found their direct phone number I decided to share it with the others to spare them the frustration I went through. So, again, I am not charging your card, I cannot cancel your account, please CONTACT THE COMPANY VIA NUMBER ABOVE!


UPDATE

Since visitors here continue to complain and ask advice, I decided to open a message board (forum) where users can exchange experiences and ask for advice.

  1. Please register first: http://forum.galanter.net/ucp.php?mode=register
  2. And login to post question/answers here: http://forum.galanter.net/viewforum.php?f=4

Never mind.

Implement “onVisible” event for HTML DOM element in JavaScript

Well, not exactly, but method described in this particular scenario can be expanded to other cases. Imagine you have a clickable element, let’s say a SPAN and when user clicks this element – it is covered by an absolutely positioned DIV with a higher z-index. In other words a dialog is displayed:

<span onclick="showDialogDiv()">Click here</span>

When user closes the dialog – your SPAN needs to detect this event, to perform some functions (refresh data on the page etc.) but you have no control over function that closes the DIV, so you can’t hook into it. All you know is that DIV’s display style is set to “none” when this happens. It would be cool if there was an “onvisible” event so you could do something like

<span onclick="showDialogDiv()" onvisible="performAction()">Click here</span>

but there’s no such event, so we need to simulate it. Which is surprisingly easy:

<span onclick="showDialogDiv(); var i=setInterval(function(){if ($('xdivDialog').style.display=="none") {clearInterval(i);performAction()}},1000)">Click here</span>

Basically when user clicks the SPAN to show the dialog – at the same time a timer is started that regularly checks visibility of the dialog DIV (whether it’s style display became “none” again). Once this is detected, that means opener SPAN is visible again – timer is stopped and function to handle event is called.

Solution for Infragistics WebDataGrid filtering error “Length cannot be less than zero”

Infragistics WebDataGrid/WHDG controls for ASP.NET offer nice filtering features. Out of the box you just have to enable the behavior and badabingo:

WebDataGrid filtering

There is one glitch though in the way text filtering is implemented: If you enter an empty string as a filter value – an error is thrown:

Async refresh failed. Length cannot be less than zero

Apparently internal grid code cannot handle empty strings (as of version 12.2) so we have to take matter in our own hands.
Continue reading →