简体   繁体   English

我的jquery数据表只显示金额列中的舍入值,我想使用货币格式的值,例如$ 233.25,但显示的是$ 234

[英]my jquery datatable shows only round values in amount column , i want to have a values with currency format like $233.25 but it shows $234

My jQuery datatable shows only round values in the amount column, I want to have values with currency format like $233.25 but it shows $234 . 我的jQuery数据表仅在value列中显示取整值,我想使用货币格式的值,例如$233.25但显示的是$234

HTML table head section: HTML表头部分:

<thead>
  <tr>
    <th>Date</th>
    <th>SalesNumber</th>
    <th>AmountExclGST</th>
    <th>GST</th>
    <th>TotalAmount</th>
    <th>ContactPerson</th>
    <th>Status</th>
    <th>FullyPaid</th>
    <th>Attachment</th>
  </tr>
</thead>

My javascript for columns: 我的JavaScript专栏:

{
  'data': 'AmountExclGST',
  'render': $.fn.dataTable.render.number(',', '.', 2, 'S$')
},

My result column : 我的结果栏:

      amount 
      S$234.00

correct format should be 正确的格式应该是

      **Amount
      S$233.77**

Please advise me what should I do, in order to get currency format with decimal values ? 请告知我该怎么办才能获得带有十进制值的货币格式?

Use this 用这个

                {
                    'data': 'AmountExclGST',
                    'render': function ( data, type, row ) {
                        return parseFloat(data).toFixed(2);
                    }
                },

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 大数值以指数格式显示 Kendo jquery 树列表 - Large number values shows in exponential format Kendo jquery Tree List jQuery显示两个相同的值不相同 - jQuery shows that two same values are not same jQuery数据表只显示一行,但JSON包含所有记录 - jQuery datatable shows only one row but JSON includes all records 为什么我的jquery数据表在第一次尝试时显示数据,但在随后的尝试中却不显示? - Why my jquery datatable shows data at first attempt but not for the subsequent attempt? Jquery 数据表功能延迟显示 - Jquery datatable features shows in delay 将 jquery 数据表中的金额列格式化为 $,千位为逗号 - format amount column in jquery datatable as $ and thousand place as comma 关闭所有组行时,DataTable显示0条记录吗? - DataTable shows 0 records when I close all of my Group Rows? jQuery fancybox中,我有一个文本区域,我想在该文本区域中填充一些文本,但第二次单击时显示,而不是第一次单击时显示 - jquery fancybox in that i have one textarea i want to populate some text in that textarea but it is shows in second click populated not in first click 我要在我的克隆元素显示后重新加载/刷新页面 - i want to reload/refresh page after my cloned element shows 动态将值绑定到jQuery multiselct控件显示单选按钮 - Binding values dynamically to jQuery multiselct control shows radio buttons
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM