This is a migrated thread and some comments may be shown as answers.

getElementPosition() JS Error

5 Answers 87 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 13 Aug 2014, 02:18 PM
I just recently upgraded from Q3 2011 to Q1 2014 and some previously working javascript code for the RadDatePicker control is now broken.  Please see attached screenshot for error in the debugger.  Can you explain either what has changed for this method or the new way of doing things?  Looking at your documentation, this method should still exist.  Both the datePicker & textBox variables are instantiated objects.

Please advise.

Thanks,
Rob

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Aug 2014, 08:31 AM
Hi Rob,

Please try to use getPosition instead of getElementPosition. Please have a look into this forum thread which I have answered for the same requirement.

Thanks,
Shinu.
0
Rob
Top achievements
Rank 1
answered on 14 Aug 2014, 02:22 PM
Thank you for your response and workaround, Shinu!

Now I'm running into a similar situation with datePicker.getElementDimensions() not existing. 

Do you have a similar workaround?
0
Accepted
Shinu
Top achievements
Rank 2
answered on 18 Aug 2014, 04:38 AM
Hi Rob,

I guess you want to get the width and height of the container. Please try the below code snippet to get the height and width of textbox in RadDateTimePicker.

JavaScript:
...
var
TimePicker = $find("<%=RadDateTimePicker.ClientID %>");
var textBox = TimePicker.get_textBox();
alert(textBox.offsetHeight);
alert(textBox.offsetWidth);
...

Thanks,
Shinu.
0
Konstantin Dikov
Telerik team
answered on 18 Aug 2014, 07:10 AM
Hello Rob,

Due to some issues with the previous method and for unification purposes, the getElementPosition() method was removed and the getLocation() method exposed in the Telerik.Web.CommonScripts.getLocation() method should be used instead:
Telerik.Web.CommonScripts.getLocation($find("datePicker1").get_element())

The same applies to the getElementDimension() method, which is now available in the Telerik.Web.UI.Calendar.Utils:
Telerik.Web.UI.Calendar.Utils.GetElementDimensions($find("datePicker1").get_element())

I have noticed that there are still some topics in our documentation referring to the old methods and I will make sure that they are be changed accordingly. 

Please excuse us for any inconvenience caused by those changes.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Rob
Top achievements
Rank 1
answered on 19 Aug 2014, 01:53 PM
Thank you both for your responses, but Shinu's suggestions worked for me.
Tags
Calendar
Asked by
Rob
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Rob
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or