Is it possible to make colspan in DataTables?

0

I have the following structure in PHP that implements a table:

foreach ($varConsulta as $lin) {
    $var1= $varConsulta[$i]['1'];
    $var2= $varConsulta[$i]['2'];
    $var3= $varConsulta[$i]['3'];
    $varFase= $varConsulta[$i]['FASE'];

    $linhas = "";
    $linhas .= "<td style='padding: 10px;'>" . utf8_encode($var1) . "</td>";
    $linhas .= "<td style='padding: 10px;'>" . utf8_encode($var2) . "</td>";
    $linhas .= "<td style='padding: 10px;'>" . utf8_encode($var3) . "</td>";

    switch ($varFase) {
        case 1:
            $linhas .= "<td colspan='2'>ALUNO NÃO APROVADO</td>";
            break;
        case 2:
            $linhas .= "<td style='padding: 10px;'><select id='".$var1."' name='".$var1."'><option value=''></option><option value='1'>SIM</option><option value='0'>NÃO</option></select></td>";
            $linhas .= "<td style='text-align: center;'><a href='#' onclick='comparecimento(".$var1.")' class='Adicionar' title='Adicionar'>.</a></td>";
            break;
        case 3:
            $linhas .= "<td colspan='2'>AGUARDANDO RESULTADO</td>";
            break;
    }

    echo "<tr>" . $linhas . "</tr>";
    $i++;
}

I wonder if there is a dataTable setting that allows column concatenation in corpo da tabela , not header

Here is the default setting I use in dataTable :

if ($("#lst").length){

    $("#lst").dataTable( {
        "bJQueryUI" : true,
        "sPaginationType" : "full_numbers",
        "iDisplayLength": 10
    });
}
    
asked by anonymous 21.01.2015 / 12:55

2 answers

3

Unfortunately, currently it is not possible to perform colspan on the rows of the table by datatables, here is an explanation given by a member of the development team:

  

I'm sorry to say that DataTables does not support colspan at the   moment The reason for this is that it is very much a non-trivial   problem in how this would interact with filtering and sorting   example how would you sort a column that has elements that span   multiple columns - which column would that belong to? The first   one, or all of them? - The same question hangs over filtering).

reference: link

If you need a translation then request but I believe that google translate gives the message.

    
21.02.2015 / 02:18
0

One way to do this would be to add in cells:

<th style="width: 40%;">Nome</th>
<td style="width: 40%;">resultado)</td>
    
05.11.2018 / 15:24