colspan or rowspan to tbody

colspan or rowspan to tbody

BFG86BFG86 Posts: 10Questions: 0Answers: 0
edited June 2013 in General
Hello everyone! =)
Please advise me how to apply colspan or rowspan for table cells(tbody>td)?
Thank you!

Replies

  • BFG86BFG86 Posts: 10Questions: 0Answers: 0
    Datatable init:

    [code]
    var tFlowRate = $("#tFlowRate").dataTable({
    "bDeferRender": true,
    "bPaginate": false,
    "bFilter": false,
    "bSort": false,
    "bJQueryUI": true,
    "bInfo": false,
    "sScrollY": "700px",
    "sScrollX": "102%",
    "bScrollCollapse": true,
    "sPaginationType": "full_numbers",
    "aoColumnDefs": [
    { "bVisible": false, "aTargets": [0] }
    ],
    "fnRowCallback": function (nRow, aData, iDataIndex, oSettings) {
    if ((aData[1].search('Сумма') != -1) || (aData[0].search('Сумма') != -1)) {
    var zTree = $.fn.zTree.getZTreeObj("treetmpar"),
    checkCount = zTree.getCheckedNodes(true).length;
    $(nRow).children("td:eq(0)").html("");
    $(nRow).children("td:eq(" + checkCount + ")").html(aData[1]);
    }
    },
    "fnDrawCallback": function (oSettings) {
    if (oSettings.aiDisplay.length == 0) {
    return;
    }

    var nTrs = $('#tFlowRate tbody tr');
    var iColspan = nTrs[0].getElementsByTagName('td').length;
    var sLastGroup = "";
    for (var i = 0, nTrsL = nTrs.length ; i < nTrsL; i++) {
    var iDisplayIndex = oSettings._iDisplayStart + i;
    var sGroup = oSettings.aoData[oSettings.aiDisplay[iDisplayIndex]]._aData[0];
    if (sGroup != sLastGroup) {
    var nGroup = document.createElement('tr');
    var nCell = document.createElement('td');
    nCell.colSpan = iColspan;
    nCell.className = "group";
    nCell.innerHTML = sGroup;
    nGroup.appendChild(nCell);
    nTrs[i].parentNode.insertBefore(nGroup, nTrs[i]);
    sLastGroup = sGroup;
    }
    }
    }
    });
    [/code]

    I need to add $(nRow).children("td:eq(0)").attr("colspan", 15); to the "fnRowCallback", but the cells are shifted.
  • BFG86BFG86 Posts: 10Questions: 0Answers: 0
    Created a sample: http://live.datatables.net/iguyar/4/edit
  • BFG86BFG86 Posts: 10Questions: 0Answers: 0
    no ideas? =)
  • sutariasutaria Posts: 1Questions: 0Answers: 0
    @BFG86 - Did you figure this one out? I am having same issues
  • allanallan Posts: 63,663Questions: 1Answers: 10,495 Site admin
    DataTables does not support colspan or rowspan in the tbody at this time. Sorry.

    Allan
  • funnyfunny Posts: 1Questions: 0Answers: 0
    @allan
    when does DataTables support colspan or rowspan in the tbody ?
  • allanallan Posts: 63,663Questions: 1Answers: 10,495 Site admin
    Not likely any time soon. If someone is willing to sponsor the work, please get in touch with me directly, but for the time being it isn't planning in the 1.x series at all.

    Allan
This discussion has been closed.