EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: pedroc on March 20, 2015, 08:17:16 AM



Title: format the datagrid header
Post by: pedroc on March 20, 2015, 08:17:16 AM
i want to format a header of a grid with this structure:
$(function(){
        $('#tt').datagrid({
            ...
            columns:[[...]]
         });
});
this is the table header
<thead>
        <tr align="center">
            <th rowspan="3" field='expediente'>Nr. Expte.</th>
            <th rowspan="3" data-options="field:'nombre',editor:'text'">Nombre&nbsp;y&nbsp;Apellidos</th>
            <th rowspan="3" field='grupo_escala'>GE</th>
            <th rowspan="3" field='categoria_ocupacional'>CO</th>
            <th rowspan="3" field='percapita'>Percap. CUC</th>
            <th rowspan="3" field='iedocpl'>IED o CPL</th>
            <th colspan="4" >% Penalizaciones</th>
            <th rowspan="3" field='ttd'>Tiempo Total para la Divisa</th>
            <th rowspan="3" field='stsp'>Salario Total Sistema Pago</th>
            <th rowspan="3" field='sb'>Salario Base Calculo</th>
            <th rowspan="3" field='ff'>Fondo Formado</th>
            <th rowspan="3" field='cd'>Coefic. Distrib.</th>
            <th rowspan="3" field='mmn'>Monto MN</th>
            <th rowspan="3" field='pmn'>Penaliz. en MN</th>
            <th rowspan="3" field='mpmn'>Monto a pagar en MN</th>
            <th rowspan="3" field='mcuc'>Monto en Divisa</th>
            <th rowspan="3" field='pcuc'>Penaliz. en Divisa</th>
            <th rowspan="3" field='mpcuc'>Monto a pagar en Divisa</th>
        </tr>
        <tr align="center">
            <th colspan="2">Cond_Esp.</th>
            <th colspan="2">CPL</th>
        </tr>
        <tr align="center">
            <th field='penl_ce_mn'>MN</th>
            <th field='penl_ce_cuc'>CUC</th>
            <th field='penl_cpl_mn'>MN</th>
            <th field='penl_cpl_cuc'>CUC</th>
        </tr>
    </thead>


Title: Re: format the datagrid header
Post by: thecyberzone on March 24, 2015, 09:08:00 AM
You can use following code to define column header using script.
Code:
$(function(){
        $('#tt').datagrid({
            ...
            columns:[[{field:'field1',title:'COLUMN HEADER HERE',width:100} ... ]]
         });
});