I am using Dojo 1.7 and I have a field in a datagrid that can have no values, one value or multiple values. I am trying to use data formatted this way:
//data
var store2 = new dojo.data.ItemFileReadStore({
data: {
identifier: "id",
items: [
{id: 1, 'personNames': ['Steve', 'Roy', 'Gary']},
{id: 2, 'personNames': ''} //blank, no person names
]
}
});
//formater
function formatPersonNames(value){
if (value == '') {
return '<p>Nobody here</p>';
} else {
return value + '<p style="margin-top:10px;">Check out the names above!</p>';
};
};
and this is the layout:
// layout
var layout2 = [
{name: 'Display Order', field: 'id', noresize:true, 'width': '50px'},
{name: 'Person Names', field: 'personNames', formatter: formatPersonNames, noresize:true}
];
The issue is that only the first name 'Steve' is showing up. I tried using value[0] as a test and that only made the first letter show up. I am new to this kind of stuff so any advice would be appreciated.