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

Extend base widget "kendo.ui.Widget"

3 Answers 222 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Iron
Marco asked on 07 Apr 2015, 02:38 PM

Hello,

Is it possible to extend the base widget "kendo.ui.Widget" ?

I tried the following, but it doesn't work:

 

var ExtendedWidget = kendo.ui.Widget.extend({
               init: function (element, options) {
                   kendo.ui.Widget.fn.init.call(this, element, options);
 
                   if (options.componentContainer != null)
                   {
                       options.componentContainer.push(this);
                   }
               },
               options: {
                   name: "Widget",
                   componentContainer: undefined
               },
           });
   kendo.ui.plugin(ExtendedWidget);

Kind Regards,

 

Marco 

 

3 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 08 Apr 2015, 10:43 AM
Hello Marco,

I think the step-by-step instructions from this documentation topic will provide the information you need for building custom Kendo UI widgets. You may also refer to this blog post for a real-life example.

Best regards,
Sebastian
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Marco
Top achievements
Rank 1
Iron
answered on 08 Apr 2015, 11:57 AM

Hello Sebastian,

 Thanks for your reply. I know how to create a custom widget. But i want to add some functionality to the kendo.ui.Widget, so that all the widgets get the same (added) functionality.

Kind Regards,

 

Marco

0
Sebastian
Telerik team
answered on 09 Apr 2015, 11:01 AM
Hello again Marco,

You can only extend the basic kendo.ui.Widget class and not add directly new functionality to its core. Hence your option would be to extend/inherit from this class and then use instances of the inherited class for additional data/functionality along with Kendo UI Widgets, if applicable.

You may also see this help topic about inheritance for further reference.

Regards,
Sebastian
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussions
Asked by
Marco
Top achievements
Rank 1
Iron
Answers by
Sebastian
Telerik team
Marco
Top achievements
Rank 1
Iron
Share this question
or