Servis-Rhino 4211B Guía de usuario Pagina 199

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 298
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 198
If we want to execute a method on the widget after it is created, we can add:
<div data-dojo-type="module/MyWidget">
<script type="dojo/method">
this.someFunction();
</script>
</div>
If we are using a Widget that has not been used before in the environment, we must take care of
AMD loading. In the <head> section add:
<script type="text/javascript>
require([
"module/MyWidget"
]);
</script>
We can connect code to to a method in declaration …
<script type="dojo/connect" data-dojo-event="method name" data-dojo-args="var name">
code here ...
</script>
We can connect code to an event in declation
<script type="dojo/on" data-dojo-event="click">
console.log("Click!");
</script>
See also:
Dojo Parser
Object Stores and Data Stores
Prior to 1.6, Dojo used a technology called "dojo/data" to store data. This is now considered a
legacy API that has been superseded by the concept of Dojo Object Stores. An adapter is provided
that maps from the old dojo/data stores to dojo/store stores. This adapter is called
"dojo/data/ObjectStore".
The dojo.store.Memory object is a data store wrapper for arrays of objects.
store = new Memory({
data: <arrayOfData>
});
When using the dojo/store classes, their properties include:
data – an Array of JavaScript objects being housed in the store
idProperty – The name of a property to be used as a search key
The resulting store object has the following methods upon it:
query – Search the store for matching records
add(object, options) – Add a new record into the store
remove(id) – Remove an existing record from the store
put(object, options) – Update an existing row in the store
get(id) – Retrieve a single object as opposed to "query" which returns an array of
objects
Page 199
Vista de pagina 198
1 2 ... 194 195 196 197 198 199 200 201 202 203 204 ... 297 298

Comentarios a estos manuales

Sin comentarios