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

javascript standardization

4 Answers 104 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Piyush Bhatt
Top achievements
Rank 2
Piyush Bhatt asked on 17 Apr 2008, 03:16 PM
I am seriously unhappy with the Javascript stanadardization in telerik client side object model. With every new release, you have a different method name.

E.g. till now you had 'set_Title(), set_Modal(); methods in RadWindow. Now they are 'set_title(), set_modal()'. Previously it was AjaxRequest()  method for Ajax Panel now it is .ajaxRequest().

Also, the Manual is not in sync with what are the javascript function names. first of all some of the controls don't even list what functions are available with the control. Some do. (If you need my help, I can surely write this all up $$ :)

By the way,  ms-help://telerik.aspnetajax.radcontrols.2008.Q1/telerik.aspnetajax.radmenu.2008.Q1/context-menus.html

Above link has following code: 
    if ((!e.relatedTarget) || (!Telerik.Web.DomUtility.isDescendantOrSelf(contextMenu.get_element(), e.relatedTarget)))

It was working till now, but the DomUtility is no more part of Telerik.Web. I don't even know what should I replace this code with now?

-Piyush


4 Answers, 1 is accepted

Sort by
0
Piyush Bhatt
Top achievements
Rank 2
answered on 17 Apr 2008, 03:33 PM

Telerik.Web.UI.RadToolTipController.getInstance();

This used to be controller.get_ActiveToolTip() now it's controller.get_activeToolTip();

0
Rumen
Telerik team
answered on 21 Apr 2008, 11:55 AM
Hi Piyush,

Let me shed some more light on the change in the client-side API naming. When we first started "Prometheus" there was no established convention in the ASP.NET AJAX libraries. Shortly after we have released the first beta of "Prometheus" we established the new convention for client-side methods - they should be all lower case as advised by Microsoft. We have immediately introduced new API following the ASP.NET AJAX conventions (that was in the summer of 2007), however for compatibility we have decided to keep the old layer for about 6 months so that customers have time to update their projects. In this period of time we have updated all product resources - documentation, demos, etc and have tried to encourage all customers to start using the new convention. Please note that this change has affected only the first few "Prometheus" controls which were developed before we established the new API convention.

With the official RadControls for ASP.NET AJAX ("Prometheus") release, the compatibility layer which was used in the transition beta period is now removed. All client-side methods strictly follow the ASP.NET AJAX conventions and are lower case. For instance: set_mode() should always be used from now on, set_Mode() is no longer supported - you have noticed this change by yourself.

Additionally, with the improving JavaScript intellisense support of the Visual Studio IDE we found it confusing to keep both naming conventions at the same time. Another important thing is that the compatibility layer we have introduced affected performance - now the client-side code runs faster than before.

There are sticky threads in the forum for each affected control. Also there is info on this change in the documentation. If you still need some help in upgrading your projects please do not hesitate to contact us - we will assist right away.

In regards to the
 
if ((!e.relatedTarget) || (!Telerik.Web.DomUtility.isDescendantOrSelf(contextMenu.get_element(), e.relatedTarget)))

in the RadMenu documentation,
it was replaced with $telerik.isDescendantOrSelf(). This omission in the documentation will be fixed right away.

We do appreciate your feedback and we updated your Telerik points.


Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Piyush Bhatt
Top achievements
Rank 2
answered on 21 Apr 2008, 05:47 PM

Interesting. I am learning today that some functions were for backward compatibility only and they were not supposed to be used. Even your support gave me some javascript that was using function names with capitals.

Anyhow, why there are some functions using underscore(_) and some don't? E.g. in calendar,

get_popupContainer
getElementDimensions

why no "_" for getElementDimensions?

-Piyush
0
Konstantin Petkov
Telerik team
answered on 22 Apr 2008, 05:59 AM
Hi Piyush,

The underscore is used for the properties only having get/set prefixes. The functions do not include an underscore.

Sincerely yours,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
General Discussions
Asked by
Piyush Bhatt
Top achievements
Rank 2
Answers by
Piyush Bhatt
Top achievements
Rank 2
Rumen
Telerik team
Konstantin Petkov
Telerik team
Share this question
or