0

UPDATE: Since the click event was wired up with an element in the kendo UI Grid control, the event was undefined. My colleague suggested to use window.event.clientX and it worked. Thanks.

I am trying to access the pageX, pageY fields inside a javascript function but it does throws up an exception as pageX being not a property of event. I am also new to client side coding. Any help would be appreciated.

Below is the code.

function showDetails(e) {
                $.ajax(
                    {
                        url: '/List/Reader',
                        type: 'json'
                    }).success(function (data, status, xhr) 
                    {
                        readers = data;
                        $("#cardholderdetails").html("");
                        var length = data.length;
                        for( var i = length-1;i>length-3; i--)
                            $("#cardholderdetails").append("<img src = " + readers[i].FileName + " width='60' height='60' id='cardholderpic'/><span>" + readers[i].Name1 + "</span><br/>");
                        $("#cardholderdetails").css('top', e.pageY+20).css('left', e.pageX+10);
                        $("#hider").append("<a id='buttonClose' href=javascript:close()>Close</a>");
                        $("#hider").fadeIn("slow");
                        $('#cardholderdetails').fadeIn("slow");
                    }).error(function (status, error) {
                        alert("Failed to retrieve alarms");
                    });

            }

What am i missing.

ckv
  • 10,539
  • 20
  • 100
  • 144
  • Since when the intellisense is the thing that count? – gdoron Jul 18 '13 at 17:38
  • Since you mention Intellisense, I assume you're using VS? Important piece of info. – Pat Lillis Jul 18 '13 at 17:40
  • @PatLillis: Yes you are correct. I just mentioned intellisense as one indicaiton . but i am getting an exception stating that the field does not exist in event. – ckv Jul 18 '13 at 17:42
  • What is calling `showDetails()`? Also the documentation for the [event object](http://api.jquery.com/category/events/event-object/) says that the pageX and the pageY properties might be undefined depending on the event. – Corion Jul 18 '13 at 17:44
  • 1
    It is being called on a click event of a cell in a KENDO UI Grid. – ckv Jul 18 '13 at 17:48
  • Sorry, misread the question, I thought it was actually about Intellisense. Try `e.originalEvent.pageX` a la [here](http://stackoverflow.com/a/8583314/2533772) and see if that works? – Pat Lillis Jul 18 '13 at 17:48
  • @PatLillis: In fact i had tried that before i asked this question. It also doe snot work same exception – ckv Jul 18 '13 at 17:53
  • Could you post a sample on JSFiddle that includes the click event? – Cezary Wojcik Jul 18 '13 at 18:30

0 Answers0