在Handson表中,如何在列中得到逗号分隔字段?(复制)

时间:2022-07-28 00:16:29

This question already has an answer here:

这个问题已经有了答案:

In handsontable a column has data like this : 24999-99999 I want to convert like this comma separated: 24,999-99,999

在handsontable中,一个列有这样的数据:2499 -99999,我想把这个逗号分隔开:24,999- 99999。

how can i acheive this for entire column in angular js handson table ???

我怎么能把这个放在角js handson表的整个列中???

Handsontable full.min.js version : 0.28.4 Angular js version : 1.4

Handsontable full.min。js版本:0.28.4角js版本:1.4。

1 个解决方案

#1


1  

I guess you have to write your own render.

我猜你得自己写稿子了。

function numberRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
  var valueArray = value.split('-');
  var str = parseInt(valueArray[0]).toLocaleString('en-IN') + '-' + parseInt(valueArray[1]).toLocaleString('en-IN');
  TD.innerHTML = str;
}


columns: [
  {
    data: 'yourcolumn',
    renderer: numberRenderer
  }
]

#1


1  

I guess you have to write your own render.

我猜你得自己写稿子了。

function numberRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
  var valueArray = value.split('-');
  var str = parseInt(valueArray[0]).toLocaleString('en-IN') + '-' + parseInt(valueArray[1]).toLocaleString('en-IN');
  TD.innerHTML = str;
}


columns: [
  {
    data: 'yourcolumn',
    renderer: numberRenderer
  }
]