Servis-Rhino 4211B Guia do Utilizador Página 205

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 298
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 204
<input type="radio"
data-dojo-type="dijit/form/RadioButton"
name="timeRangeMethod"
id="${id}_rollingPeriod"
value="rollingPeriod"/>
<label for="${id}_rollingPeriod">Rolling Period</label>
See also:
Parsing Dijit in HTML
dijit/_TemplatedMixin – 1.9
dijit/_WidgetsInTemplateMixin – 1.9
Creating Template-based Widgets – 1.9
Skeleton widget
Here is a useful skeleton for a widget. This can be copied and pasted into a JavaScript source file as
a good place to start building out your own widget:
define(
[
"dojo/_base/declare",
"dijit/_WidgetBase",
"dijit/_WidgetsInTemplateMixin",
"dijit/_TemplatedMixin",
"dojo/text!./templates/myTemplate.htm"
],
function (
declare,
_WidgetBase,
_WidgetsInTemplateMixin,
_TemplatedMixin,
template) {
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
// Body of widget here
templateString: template
}); // End of declare
}
); // End of define
Extending a widget
Existing Dijit widgets can be extended to provide customized function. For example
return declare("kolban.widget.TaskTable", [DataGrid], {...});
will extend a DataGrid table.
We can override existing functions. If we wish to call the parent's function, we can code:
this.inherited(arguments);
Using getters and setters on a custom widget
If a custom widget has properties associated with it, we can define functions that act as custom
getters and setters. The correct way to retrieve a property from a widget is
var value = myWidget.get("propertyName");
the correct way to set a property on a widget is:
myWidget.set("propertyName", newValue);
Within the implementation of a widget, we define a getter function as a function with the name:
_get<PropertyName>Attr: function() {
return value;
}
Page 205
Vista de página 204
1 2 ... 200 201 202 203 204 205 206 207 208 209 210 ... 297 298

Comentários a estes Manuais

Sem comentários