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

jQuery chaining not working

3 Answers 84 Views
ScriptManager and StyleSheetManager
This is a migrated thread and some comments may be shown as answers.
AkAlan
Top achievements
Rank 2
AkAlan asked on 14 Aug 2011, 12:30 AM

I am using jQuery for setting controls.

 

 

var

 

 

status = $telerik.findComboBox("<%= rcbStatus.ClientID %>");

 

status.set_value(2);

status.set_text(

 

"On Order");

My understanding of jQuery (which is limited) is that I should be able to chain commands like this:

 $telerik.findComboBox("<%= rcbStatus.ClientID %>").set_value(2).set_text("On Order");

But the chanined command doesn't work.

 

Am I missing something? Thanks for any help

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Ivan Zhekov
Telerik team
answered on 16 Aug 2011, 08:05 AM
Hello Akalan,

If you need to find the client object of RadComboBox, please refer to this help topic and use this approach:

var combo = $find("<%= RadComboBox1.ClientID %>");

Not all methods starting with $ represent jQuery, or must be related to jQuery. In this particular example, $telerik represents our company namespace.

As for chaining, it depends on what's returned from the first method and can the next method be applied upon and so on and so forth.

In the case of $telerik.findComboBox, that method returns an object. That's what the first line is about. That object (status) has methods of it's own; like set_value and set_text that can be applied only on this object.

However, since none of those methods actually returns anything (they are setters) chaining can not be effectively achieved, hence the error.

I hope this explanation helps.

Regards,
Ivan Zhekov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
AkAlan
Top achievements
Rank 2
answered on 16 Aug 2011, 06:45 PM
Hi Ivan, thanks very much, your reply helped me a lot. I got my page working perfectly!

i do have a copuple of follow up questions that would help me better understand how Telerik deals with javaScript and jQuery.

I'm developing with VS 2010 SP1.
I use asp.net Master Pages and put a scriptmanager (sm) on it as I read you should.
I have read that if I want intellisense during development I should use the asp.net scriptmanager and then during production use the RadScriptManager.
I don't quite understand the concept. I can't se any difference in the intellisense I get with using either one. Is that something that has changed with VS 2010 or does it still apply?
If it still applies, then If I am developing with the asp.net sm, will I not see the built in functionallity of the various Rad controls?
My understanding is that Telerik has modified jQuery in their libraries to make their controls work properly.
Are the modifications meant only for stuff that is "under the hood?" 

Here is what I have placed on my Master Page:

<

 

 

telerik:RadScriptManager ID="RadScriptManager1" runat="server">

 

 

 

<Scripts>

 

 

 

 

<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />

 

 

 

<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" />

 

 

 

<asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" />

 

 

 

</Scripts>

 

 

 

</telerik:RadScriptManager>

 


If there is a change to the core jQuery library, is there something I need to do to update it or does it just get updated the next time I upgrade my Telerik controls?

Thanks again for your help, it has really helped my understanding and ability to develop faster.
0
Accepted
Ivan Zhekov
Telerik team
answered on 19 Aug 2011, 11:36 AM
Hello Akalan,

I will try to answer the questions one by one:

About the script manager -- Telerik Rad Script Manager offers more than the basic asp one. That's why in production you are likely to gain benefits from using the Telerik control instead of the built in one. I can't comment on the intellisense part.

jQuery and Telerik -- Telerik uses jQuery for building some controls. A "local" copy of jQuery is saved in $telerik.$ for referencing. We do this to be absolutely sure that we know which version of jQ we are using. For instance there could be a number of jQ scripts loaded on the page by the developer, but the Telerik controls need a specific version. Hence the "saving".

That said, jQuery(), $() and $telerik.$() should do the same, but if you are uncertain if jQ is already loaded, just use $telerik.$

Updating the libraries -- Like mentioned above, we save a copy of the jQ we need. We take care of that version and the updates. And if we indeed change the library to a newer version, it will be mentioned in our release notes.

I hope that answers your questions.


Best wishes, Ivan Zhekov
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
ScriptManager and StyleSheetManager
Asked by
AkAlan
Top achievements
Rank 2
Answers by
Ivan Zhekov
Telerik team
AkAlan
Top achievements
Rank 2
Share this question
or