I have just run through the dgrid tutorial explaining how to use stores with your grid and I tested you render cell function by replacing all the columns with just your example, but obviously chose a field name included in the json they use. It worked a treat. Take a look at the example I referred to, it may help, it does not include renderCell, but it is a good starting point.
To display some value from the data in the returned div I could just pick out the value argument to display in the returned html like so...
function testRenderCell(object, value, node, options){
var div = document.createElement("div");
div.className = "renderedCell";
div.innerHTML = value;
return div;
}
Here is the code snippet from my own index file, the data I used was just a local version of the data they used in the example that I copied onto my system.
require([
"dojo/request",
"dojo/store/Memory",
"dgrid/OnDemandGrid"
], function (request, Memory, OnDemandGrid) {
function testRenderCell(object, value, node, options){
var div = document.createElement("div");
div.className = "renderedCell";
div.innerHTML = value;
return div;
}
request("/DGridTests/data.json", {
handleAs: "json"
}).then(function (response) {
// Once the response is received, build an in-memory store with the data
var store = new Memory({ data: response });
// Create an instance of OnDemandGrid referencing the store
var grid = new OnDemandGrid({
store: store,
columns: [
{
label: "Test",
field: "first",
width: "150px",
renderCell: testRenderCell
}
]
}, "grid");
grid.startup();
});
});
The docs for the Grid and details on the renderCell function can be found here.
There are a few possible reasons for your [Object] rendered content, the first could be to check if you are also using 'formatter' as that will override 'renderCell'.
The second would be to make sure that the value or field you are seeing by the time you get into your renderCell function is not an Object itself, you may need to just pull out the variable you need.
The third is the grid doesn't like the way your injecting in its columns, possibly back track a little and refactor you code into a simpler syntax, adding the columns as part of the grids constructor arguments as in my code snippet. You can always add complexity later on.
I hope that helps, if I think of anything else I'll add more, good luck.
[UPDATE]
Ok reading David's answer, I tried out not returning anything and just altering the node instead. It seems to work, here is the function changed to do this. I'm not sure whether I like not returning anything, it is a little less obvious what the function is doing, but still it works so thats cool...
function testRenderCell(object, value, node, options){
node.innerHTML = value;
}