格式化数字,日期

mtpGrid.formatCheckBox = function(gridId, radio) {
return function(inDatum, rowIndex) {
var checks = eval(gridId+'.checks');
return '<input type="'+(radio?'radio':'checkBox')+'" name="'+gridId+'.checkBox" id="'
+gridId+'.'+inDatum+'" '+ (checks[inDatum]!=null?'checked':'')
+ ' onclick="mtpGrid.on'+(radio?'Radio':'CheckBox')+'Selected(\''+gridId+'\', this.id, '+rowIndex+')"/>'
+ '<label for="'+gridId+'.'+inDatum+'" class="access">'+gridId+'.'+inDatum+'</label>';
};
}

mtpGrid.formatDate = function(inDatum, rowIndex){
if(inDatum){
if (inDatum.time) inDatum=inDatum.time;
return dojo.date.locale.format(new Date(inDatum),
{datePattern:"dd MMM yyyy", selector:"date"});
}else{
return "";
}
};

mtpGrid.formatNumber = function(inDatum, rowIndex){
if(inDatum != null){
return dojo.number.format(new Number(inDatum),
{pattern:"#,##0.00"});
}else{
return "";
}
};

mtpGrid.formatTime = function(inDatum, rowIndex){
if(inDatum){
if (inDatum.time) inDatum=inDatum.time;
return dojo.date.locale.format(new Date(inDatum),
{datePattern:"dd MMM yyyy"});
}else{
var result = "<span style = 'color: #666;'> N/A </span>";
return result;
}
};

你可能感兴趣的:(dojo)