Utilisation des classes d'objet dans un widget
Bonjour.
J'essaie KendoUI dès aujourd'hui.
Disons que j'ai une classe "Person" :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| var Person = kendo.Class.extend({
firstName: 'Not Set',
lastName: 'Not Set',
isAPrettyCoolPerson: false,
sayHello: function() {
alert("Hello! I'm " + this.firstName + " " + this.lastName);
}
}); |
et que je cré un widget :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| (function($, undefined) {
var kendo = window.kendo,
ui = kendo.ui,
Widget = ui.Widget;
var MyWidget = Widget.extend({
init: function(element, options) {
var that = this, id;
// base call to initialize widget
Widget.fn.init.call(that, element, options);
element = that.wrapper = that.element;
options = that.options;
options.url = window.unescape(options.url);
},
options: {
name: "MyWidget",
url: ""
},
});
ui.plugin(MyWidget);
})(jQuery); |
Comment puis-je utiliser ma classe "Person" dans mon widget ?
si j'essaie d'instancier un objet "Person", la classe n'est pas reconnue...
Merci :).