datagrid合并表頭單元格

效果如下:
效果圖
源碼如下:

rowspan: 2 (表示該列跨兩行)
colspan: 2 (表示跨兩列)
(以下代碼有重復部分已省略,僅以實現(xiàn)功能展示效果為主)

 columns: [
            [
                { field: 'forecast',  title: '預估出貨量', rowspan: 2, align: 'center',  titleAlign: true },
                { field: 'solution', title: '方案選擇', rowspan: 2, align: 'center', titleAlign: true,
                    editor: {  options: {valueField: 'docTypeCn', textField: 'docTypeCn', panelHeight: 'auto'}
                        type: 'textbox', options: {readonly:true} }  },
                {field: 'cost', title: '場地占用成本', colspan: 2,rowspan: 1,align: 'center',  titleAlign: true,
                    editor: {type: 'textbox', options: {required: true}}},
                {field: 'human', title: '人力投入',  colspan: 3, rowspan: 1,  align: 'center', titleAlign: true,
                 editor: {type: 'textbox', options: {required: true}}},
                { field: 'device', title: '設(shè)備投資',  colspan: 4,  rowspan: 1,align: 'center',  titleAlign: true,editor: {type: 'textbox', options: {required: true}} },
                    { field: 'mOutput',   title: '月產(chǎn)能',   width: 10, rowspan: 2, align: 'center',  titleAlign: true,editor: { type: 'textbox'}},
                    {field: 'unitCost',title: '單位成本', width: 10,rowspan: 2,align: 'center',titleAlign: true,editor: { type: 'textbox'}},  
            ],[
                {field: 'needArea', title: '所需面積',  rowspan: 1, align: 'center', titleAlign: true,  editor: { type: 'textbox'}}, {  field: 'areaMde', title: '月折舊',rowspan: 1, align: 'center', titleAlign: true,editor: {type: 'textbox'}  },
                { field: 'operatorLevel',  title: '人員類別',  rowspan: 1, align: 'center',   titleAlign: true,  editor: { type: 'textbox'} // disabled: true  },
                {  field: 'number',  title: '人數(shù)',   rowspan: 1,  align: 'center', titleAlign: true,  editor: { type: 'textbox'}// disabled: true  },
                { field: 'mCost',title: '月薪資',rowspan: 1,align: 'center',titleAlign: true, editor: { type: 'textbox'}  // disabled: true },
                { field: 'eipType', title: '設(shè)備投資方式', rowspan: 1,align: 'center', titleAlign: true,editor: { type: 'textbox'} // disabled: true },
                {field: 'eipAmound', title: '設(shè)備投資總額', rowspan: 1,align: 'center',  titleAlign: true,editor: { type: 'textbox'}// disabled: true },
                { field: 'eMde', title: '月折舊', rowspan: 1,align: 'center',titleAlign: true,editor: { type: 'textbox'}  // disabled: true },
                { field: 'weaCost', title: '水、電、氣', rowspan: 1,
                    align: 'center', titleAlign: true,editor: { type: 'textbox'}// disabled: true },
                ]

        ],

其他可參考

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內(nèi)容