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

How to extend the kendoListView widget

3 Answers 727 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Phil H.
Top achievements
Rank 2
Phil H. asked on 09 Jun 2014, 06:43 PM
Hi:

I would like to add my own methods on the to ListView as follows:
$("#AlertListView").kendoListView({
     dataSource: {
        data: []
    },
    template: "<li>#: message #</li>",
    displayMessages: function( messages ) {
        ...
    },
    hideMessages: function( ) {
        ...
    }
});

Phil

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 10 Jun 2014, 06:36 AM
Hi Phil,

Please check this tutorial as it explains how to extend/create Kendo UI widgets.
I would like to point out that assistance related to creating custom widget or extending the build-in functionality of the existing ones is out of the scope of our support services.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Phil H.
Top achievements
Rank 2
answered on 10 Jun 2014, 11:14 PM
Hi:

I was already familiar with that page.  That addresses building a widget from the Widget class.  I am working with the ListView and would like to extent it.  Before I posted, I was unable to extend ListView, I am getting object does not support method 'extend'.  I would guess that all kendo objects use Widget as the prototype, so it should support extend method.

Phil
1
Accepted
Alexander Valchev
Telerik team
answered on 11 Jun 2014, 07:23 AM
Hello Phil,

I prepared a small example that demonstrates how to extend (add methods to) an existing widget.
The approach uses extend method of the widget:
(function ($) {
  var CustomListView = kendo.ui.ListView.extend({
    options: {
        name: "CustomListView"
    },
    say: function(message) {
        console.log(message);
    }
  });
  kendo.ui.plugin(CustomListView);
})(jQuery);

I hope this will help.

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ListView
Asked by
Phil H.
Top achievements
Rank 2
Answers by
Alexander Valchev
Telerik team
Phil H.
Top achievements
Rank 2
Share this question
or