possible bug with canvas [sparklines] and fixed columns?

possible bug with canvas [sparklines] and fixed columns?

ajoslin103ajoslin103 Posts: 20Questions: 4Answers: 0

I have a datatables table setup in a standalone html doc (I've started making all my reports for management standalone html docs with datatables and they are going ga-ga over them) that is using sparklines and it looks great !!

But when I turn on fixed columns then the sparklines are reduced to a 1-pixel wide display even tho' the canvas is the right width when you inspect it...

I'm running on latest chrome over latest mac os x

thanks for your time
Al;

see this jsbin https://jsbin.com/pifaroyake/edit?html,output

search on: uncomment -- to find the change to make
// uncomment this to break the sparklines
// obj.fixedColumns = {leftColumns: 2 };

This question has an accepted answers - jump to answer

Answers

  • ajoslin103ajoslin103 Posts: 20Questions: 4Answers: 0

    perhaps this is instead a bug in the fixedColumns() part of the api -- when I changed by code to access the static column-cells without using datatables then I was able to put in the sparklines

    obviously, this is a non-optimal solution -- but it keeps me moving for now!

        $.fn.dataTable.Api('#table-1').columns(1).nodes()[0].forEach((e,x)=>{
            $(`#table-1_wrapper .DTFC_LeftBodyWrapper tr:eq(${x})`).find('td:eq(1)').sparkline(dataset.body[x].data.slice().reverse());
        });
    
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    I think the problem is the cloning of the original table cells. Your columns().nodes() loop is acting upon the original cells, rather than the floating cloned cells. Your workaround above is probably the best option at the moment.

    Allan

  • ajoslin103ajoslin103 Posts: 20Questions: 4Answers: 0

    Is access to the floating cloned cells planned?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Its something I would like to add, but I'm not certain what the correct API would be for it. columnsFloating().nodes() perhaps, but that could possibly confusing and I'm concerned about how much code that would add.

    Allan

  • ajoslin103ajoslin103 Posts: 20Questions: 4Answers: 0

    columnsFixed().clonedNodes()

This discussion has been closed.