who knows a way to create a custom cell fora dojox.grid.DataGrid
? I of course could use the get and formatter开发者_C百科 properties of the layout, but this is not a really reusable solution!
Thanks for your input!
heinrich
What do you mean by custom cell?
Do you want to use check box or textbox instead of text? or
Do you want to show images instead of text?
In the first case
- give 'editable'="true"
- set 'singleClickEdit'= "true" and
- set cellType variable. You can extend the default editor class and make your own editor class.
In the second case you can use the formatter function.
It is better to use the existing functions and classes. Extending will make the grid slower.
You can try an indirect way to add a dojo widget to a grid cell
1) Set escapeHTMLInData
to false
for the dojox.grid.DataGrid
2) Then in the get/formatter function try something like
function formatterFn() {
var buttonToReturn = dijit.form.Button({
/* Button attributes */
}
var div = document.createElement("div");
div.appendChild(buttonToReturn.domNode);
return div.innerHTML;
// You can leave the div orphan
}
You can conditionally return different widgets to suit your needs
Hope it helps!
精彩评论