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

RadDock and IScriptControl

6 Answers 93 Views
Dock
This is a migrated thread and some comments may be shown as answers.
nechmads
Top achievements
Rank 1
nechmads asked on 03 Sep 2007, 04:32 PM
Hi.
We are developing a custom portal application.
I created a class called BaseWidget that inherit from RadDock. The purpose is to provide all the basic widget capabilities in one class (as we have a few different kinds of widgets). For example to add to all widgets the same toolbar, title bar, etc...

As all our application is fully AJAX based, our widgets also inherits from IScriptControl in order to attach to it some client side capabilities.

I noticed that if my widget class (that inherits from RadDock) also inherits from IScriptControl, the drag and drop capability of the RadDock stops working completely.

Is there any way to use RadDock and IScriptControl?

6 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 04 Sep 2007, 07:18 AM
Hello nechmads,

RadDock already implements IScriptControl so you could simply override GetScriptDescriptors() and GetScriptReferences() methods to achieve the desired functionality. Hope this helps.

Sincerely yours,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
paulo.galão
Top achievements
Rank 1
answered on 04 Sep 2007, 10:15 PM
Hi there Petya,

It might seem silly but... can you provide an example where a class that derives from RadDock overrides IScriptControl methods and attaches some client side script to the control?

Thanks,
Paulo 
0
nechmads
Top achievements
Rank 1
answered on 05 Sep 2007, 06:22 AM
Hi Petya.
You right. RadDock already implements IScriptControl, but it marks the methods as private and not protected!
This means I can't override it in my own class (and I cant call them, the base emthods, in order to let RadDock keep it's functionality).
0
Valeri Hristov
Telerik team
answered on 05 Sep 2007, 08:49 AM
Hello nechmads,

You are right, RadDock (and all other Prometheus controls) do not provide a way to override IScriptControl.GetScriptDescriptors(). I added a new protected virtual GetScriptDescriptors() in the RadDock base class. Please, find attached the latest build of RadDock Prometheus which contains the new method.

Greetings,
Valeri Hristov (Senior Developer, MCSD)
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
nechmads
Top achievements
Rank 1
answered on 05 Sep 2007, 10:24 AM
Thanks Valeri for the quick response.
I used the hot fix you sent and I'm able to ovveride the methods. But...

My problem now is that when I use the $find method to get the instance of my control on the client, I get all the functionality that you provide but not the methods that I provided in my script.

My question is: How can I add more client side functionality?
Should my client side class inherit from your RadDock client class (if do what is it?)

the code I used to override your methods is:

 

protected override System.Collections.Generic.IEnumerable<ScriptDescriptor> GetScriptDescriptors()  
        {  
            System.Collections.Generic.IEnumerable < ScriptDescriptor > baseCollection = base.GetScriptDescriptors();  
 
            ScriptControlDescriptor descriptor = new ScriptControlDescriptor("custom.MyRadDock"this.ID);  
            descriptor.AddProperty("myCustomProp""hello world");  
 
            System.Collections.Generic.List<ScriptDescriptor> myCollection = new System.Collections.Generic.List<ScriptDescriptor>();  
            myCollection.Add(descriptor);  
 
            myCollection.AddRange(baseCollection);  
 
            return myCollection.ToArray();  
        }  
 
 
        protected override System.Collections.Generic.IEnumerable<ScriptReference> GetScriptReferences()  
        {  
            ScriptReference reference = new ScriptReference();  
            reference.Path = ResolveClientUrl("~/Scripts/MyRadDock.js");  
 
            System.Collections.Generic.IEnumerable < ScriptReference > baseCollection = base.GetScriptReferences();  
 
            System.Collections.Generic.List<ScriptReference> myCollections = new System.Collections.Generic.List<ScriptReference>();  
 
            myCollections.Add(reference);  
 
            myCollections.AddRange(baseCollection);  
                          
            return myCollections.ToArray();  
        } 
0
Petya
Telerik team
answered on 10 Sep 2007, 11:16 AM
Hello nechmads,

In your MyRadDock.js file you can enhance the current client-side API using the following approach:

Telerik.Web.UI.RadDock.prototype.set_Size = function(width, height)
    {
        this.get_element().style.width = width;
        this.set_Width(width);
        this._setCommandsContainerWidth();
       
        this.get_element().style.height = height;
        this.set_Height(height);
        this._setContentContainerHeight(true);
       
        this.updateClientState();
    }

This is an example of adding a set_Size function to RadDock's client-side API. In case you need further assistance, just let us know.

Best wishes,
Petya
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Dock
Asked by
nechmads
Top achievements
Rank 1
Answers by
Petya
Telerik team
paulo.galão
Top achievements
Rank 1
nechmads
Top achievements
Rank 1
Valeri Hristov
Telerik team
Share this question
or