2024年4月9日 星期二

V20304A – Grid – 編輯欄位 –[需求工時]欄位 , 不可空白 - editor - Ext.grid.plugin.CellEditing

 目的: V20304A – Grid – 編輯欄位 –[需求工時]欄位

處理說明: 1> sub_Grid 設為可編輯 : 
                       sub_Grid.plugins : 'Ext.grid.plugin.CellEditing'
                  2> Columns editor : 欄位設為可編輯  
                         editor: 'textfield',
                         另一方式: 
                         editor: { xtype: 'textfield', allowBlank: false}, //不允許空白

                   

1>*.js
1>>sub_Grid
var sub_Grid = Ext.create('TMGrid', {
        grid_id: 'sub_Grid',
        columns: sub_Columns,
        //autoScroll: true,
        flex: 1,
        store: Ext.create('gridstore', { model: sub_model }),
        plugins: [
            //Ext.create('Ext.grid.plugin.RowEditing', {   // 會出現[Update][Cancel]鈕
            Ext.create('Ext.grid.plugin.CellEditing',// 不會出現[Update][Cancel]鈕, 直接編輯
                clicksToEdit: 1                           // 按一下進行編輯,預設為按兩下
            })],
    });


2>> columns:
var sub_Columns = [
    { header: "", xtype: "rownumberer", width: 40, align: "center", sortable: false },
      
  {
        header: "需求工時", dataIndex: "RQHR", width: 70, sortable: false, align: "right", 
        TMType: "float", renderer: Ext.util.Format.numberRenderer('0,000.00'),
        editor: { xtype: 'textfield', allowBlank: false}, //不允許空白
        //editor: 'textfield',
    },


沒有留言:

張貼留言