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

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 298
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 188
First we can create a column in the grid to hold the button.
{ field: "name", name: "Actions", widgetsInCell: true,
decorator: function() {
return "<div data-dojo-type='dijit/form/Button' data-dojo-attach-point='btn' data-dojo-
props='title: \"MyTitle\", iconClass: \"myIcon\", showLabel: false,
baseClass: \"minimalButton\"'></div>";
},
getCellWidgetConnects: function(cellWidget, cell) {
return [
[ cellWidget.btn, 'onClick', function(e) {
// 'cell' contains the cell clicked …
// 'cell.row' contains the row
// Do something here ...
}]
];
} //End of getCellWidgetConnects
} // End of Actions column
The related CSS looks like:
.myIcon {
background-image:url("images/myIcon.png");
width: 16px;
height: 16px;
text-align: center;
background-repeat: no-repeat;
}
.minimalButton {
}
.minimalButton .dijitButtonNode {
border: 0px;
}
The dgrid – The next generation Dojo Data Grid?
The grid has a columns property which defines which columns are to be shown. It can be
supplied in a number of ways including an array of objects of "field/label":
[
{
field: "first",
label: "First Column"
},
{
field: "second",
label: "Second Column"
}
]
Data can be passed to the grid via the "renderArray(data)" method which takes as a
parameter an array of objects. These objects will be rendered in the grid. It has been noted that
data doesn't always disappear if we execute renderArray() a second time. Invoking
refresh() before a render seems to work.
The way to create a grid is with:
var grid = new Grid({
columns: // Columns definition
}, "gridId");
grid.renderArray(myData);
See also:
dgrid
Installing Dgrid
Dgrid has a number of prereqs:
Page 189
Vista de página 188
1 2 ... 184 185 186 187 188 189 190 191 192 193 194 ... 297 298

Comentários a estes Manuais

Sem comentários