【发布时间】:2017-03-14 12:30:09
【问题描述】:
我想为剑道网格中的列应用数字格式。该列定义是:
{
field: "WeekEndGrossUSD",
title: dashBoardColumNames[0].WeekendGrossUSD,
headerTemplate: "<span class= 'headerTooltip' id='WEEKEND GROSS (USD)'>" + dashBoardColumNames[0].WeekendGrossUSD + "</span>",
format: "{0:n0}",
type: "number",
attributes: { style: "font-size: 0.85em;text-align:right" },
footerTemplate: "<span id='WeekendGrossSUM'></span>"
//width: 120
},
{
field: "WeekGrossUSD",
title: dashBoardColumNames[0].WeekGrossUSD,
headerTemplate: "<span class= 'headerTooltip' id='WEEK GROSS (USD)'>" + dashBoardColumNames[0].WeekGrossUSD + "</span>",
format: "{0:n0}",
type: "number",
attributes: { style: "font-size: 0.85em;text-align:right" },
footerTemplate: "<span id='WeekGrossSUM'></span>"
//width: 120
},
{
field: "CumulativeGrossUSD",
title: dashBoardColumNames[0].CumeGrossUSD,
headerTemplate: "<span class= 'headerTooltip' id='CUME GROSS (USD)'>" + dashBoardColumNames[0].CumeGrossUSD + "</span>",
format: "{0:n0}",
type: "number",
template: '<a class="titlehyperLink" style="color:blue" id="cumeTemplate">${CumulativeGrossUSD}</a>',
attributes: { style: "font-size: 0.85em;text-align:right" },
width: 120,
}
上述列定义具有将文本转换为数字格式的格式属性。但是在将超链接列应用到“CumulativeGrossUSD”文件后,数字格式不适用。它错过了逗号数字的格式。请参考屏幕截图
点击超链接代码
$(self.TitleViewGridID).on("click", "#cumeTemplate", function (e) {
var grid = $(self.TitleViewGridID).data("kendoGrid");
var dataItem = grid.dataItem($(e.currentTarget).closest("tr"));
sessionStorage.setItem("IsDashboardCumeClicked", true);
window.location.href = "/International/TerritoryTitleList?TitleId=" + dataItem.TitleId;
});
如果我删除上述语法中的标题模板,它会给出数字格式,用逗号分隔。但是,如果我应用了标题模板,它不会给出逗号单独的格式。找到随附的屏幕截图。
【问题讨论】:
-
您未显示的其余代码一定有问题。这是一个使用您提供的列定义的 Dojo,数字用逗号格式化:dojo.telerik.com/@Stephen/Uyobi。你能修改 Dojo 来复制你的问题吗?
标签: javascript user-interface kendo-ui kendo-grid