Simple Style format on a pivot column

Comments

5 comments

  • Avatar
    Justin Twohig

    Hi Eduardo,

     

    You should be able to target a column via this code:

     

    widget.on('ready', function(se, ev){

    var columnIndex = 4; //The index of the column to change (starting with 0)

    for (i = 0; i < $('tbody')[0].rows.length; i++) {
    $($('tbody')[0].rows[i].cells[columnIndex]).css({
    'text-align': 'center'
    });
    }

    });
    1
    Comment actions Permalink
  • Avatar
    Ronen Avidor

    also take a look at this post, just change the alignment to center

     

    https://support.sisense.com/hc/en-us/community/posts/221227728-Right-align-numeric-dimensions-in-pivot-and-table-widgets 

     

     

    0
    Comment actions Permalink
  • Avatar
    Eduardo Ponce de Leon

    Hi All,

    Thank you for the replies, perhaps in the image it is not clear, but I also want to make bold the column at the far right and I have not been able to do so. Also, the code provided only centers the numbers and not the text, with this line I am able to center all the text, but the column on the far right which is a value column in the pivot table. The first 4 columns are rows.

    //this works for everything except the far right column

    widget.on('ready', function(w, args) {
        $('div', $('td.p-dim-member', element)).css('text-align', 'center');
    });

     

     

    0
    Comment actions Permalink
  • Avatar
    Ronen Avidor

    Hi, just add this to your code .css({'font-weight':'bold'})

    0
    Comment actions Permalink
  • Avatar
    Eduardo Ponce de Leon

    Ronen,

    Thank yout this almost achieves what I want, my last issue is that when I centered the right column, the format was applied to the whole column and I dont want the column title to be centered.

    widget.on('ready', function(w, args) {
        $('div', $('td.p-dim-member', element)).css('text-align', 'center');
        $('td[fidx=4]',element).css('text-align','center');
        $('td[fidx=4]',element).css({'font-weight':'bold'})
    });

     

     

    0
    Comment actions Permalink

Please sign in to leave a comment.