2024年7月7日 星期日

V20304A – 1>將空字串維持空字串, 小數的位數維持2位小數 – 即 model 的數值不轉換(convert) - renderer時若為小數,則格式化

目的: V20304A – 1>將空字串維持空字串, 小數的位數維持2位小數
                                  – 即 model 的數值不轉換(convert)
                             2>將空字串變成 0.00,小數的位數維持2位小數 – 即 model的數值,需轉換
                             3>輸出的數量,小數的格式(0000.00) – 即columns的 renderer的數值,需格式化

處理說明: 1>將空字串維持空字串,  - model
                         {  name: "RQHR",
                            //convert: function (value, record) { return Ext.util.Format.round(value, 2); }
                           },
                     2>小數欄位輸出的格式 : 0000.00
                        {
        header: "需求工時", dataIndex: "RQHR", width: 70, sortable: false, align: "right", TMType: "float",
        renderer: Ext.util.Format.numberRenderer('0,000.00'),
        editor: { xtype: 'textfield', allowBlank: true }, //允許空白
    },


1>V20304A_JSON.js
var sub_model = [
    { name: "FMNO" },
    { name: "AMINO" },
    { name: "ITM" },
    { name: "ITMNO" },
    { name: "WKDESC" },
    {
        name: "STDHR",
        convert: function (value, record) { return Ext.util.Format.round(value, 2); }
    },
    {
        name: "RQHR",
        //convert: function (value, record) { return Ext.util.Format.round(value, 2); }
    },
    { name: "REMARK" },
    { name: "PNSHTNO" }
];

var sub_Columns = [
    { header: "", xtype: "rownumberer", width: 40, align: "center", sortable: false },
    //{ header: "系統件單號", dataIndex: "FMNO", width: 130, sortable: false, TMType: "string" },
    { header: "AMM項次", dataIndex: "AMINO", width: 80, sortable: false, TMType: "string" },
    //{ header: "流水序號", dataIndex: "ITM", width: 50, sortable: false, TMType: "string" },
    { header: "項次", dataIndex: "ITMNO", width: 70, sortable: false, TMType: "string" },
    { header: "工作項目", dataIndex: "WKDESC", width: 150, sortable: false, TMType: "string" },
    { header: "標準工時", dataIndex: "STDHR", width: 70, sortable: false, align: "right", TMType: "float", renderer: Ext.util.Format.numberRenderer('0,000.00') },
    {
        header: "需求工時", dataIndex: "RQHR", width: 70, sortable: false, align: "right", TMType: "float",
        renderer: Ext.util.Format.numberRenderer('0,000.00'),
        editor: { xtype: 'textfield', allowBlank: true }, //允許空白
        //editor: 'textfield',
    },
    {
        header: "備註", dataIndex: "REMARK", width: 250, sortable: false, TMType: "string",
        editor: { xtype: 'textfield', allowBlank: true }, //允許空白
        },
    //{ header: "件號專用表單編號", dataIndex: "PNSHTNO", width: 500, sortable: false, TMType: "string" }
];

沒有留言:

張貼留言