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

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 298
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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 página 198
1 2 ... 194 195 196 197 198 199 200 201 202 203 204 ... 297 298

Comentários a estes Manuais

Sem comentários