【发布时间】:2015-08-26 14:41:08
【问题描述】:
我正在使用 handsontable 在类似 ASP.NET MVC Excel 的应用程序中编辑数字数据。 我通过此代码设置单元格格式:
numeral.language('ru', {
delimiters: {
thousands: ' ',
decimal: ','
},
abbreviations: {
thousand: 'k',
million: 'm',
billion: 'b',
trillion: 't'
},
ordinal: function (number) {
return number === 1 ? 'er' : 'ème';
},
currency: {
symbol: '€'
}
});
var container = document.getElementById('hot');
var workflowActionType = '@ViewBag.WorkflowActionType';
var hot = new Handsontable(container,
{
data: data,
maxRows: 32,
colWidths: [500, 60, 100, 100, 100, 100],
cells: function (row, col, prop) {
var cellProperties = {};
cellProperties.type = "numeric";
cellProperties.format = '0.00';
cellProperties.language = 'ru';
if (row === 0) {
cellProperties.renderer = headerRowRenderer;
cellProperties.readOnly = true;
}
if (col === 0 && (row !== 0 || row !== 1)) {
cellProperties.readOnly = true;
}
if (row === 1) {
cellProperties.renderer = numberRowRenderer;
cellProperties.readOnly = true;
}
if (col === 1 && row !== 0 && row !== 1) {
cellProperties.renderer = rowCodeRenderer;
cellProperties.readOnly = true;
}
if ((col === 2 || col === 3 || col === 4 || col === 5) &&
(row === 0 || row === 1)) {
cellProperties.readOnly = true;
}
return cellProperties;
}
});
此行设置的数字格式:
cellProperties.type = "numeric";
cellProperties.format = '0.00';
cellProperties.language = 'ru';
之后,在本地开发环境(由 Visual Studio 运行的 IIS Express)上,所有数字都对齐。但在生产服务器上 - 所有数字都左对齐。我做错了什么?
【问题讨论】:
标签: javascript asp.net handsontable