jspreadsheet / ce

Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
https://bossanova.uk/jspreadsheet/v4
MIT License
6.73k stars 825 forks source link

Hide Columns #765

Closed VictorCandido closed 4 years ago

VictorCandido commented 4 years ago

Hello. Is there any way of hide a column? When I use $('column').hide(), I loose all my CSS configuration, so could be very nice to have an implementation of an event to hide a column by it's index.

GBonnaire commented 4 years ago

Hi,

You can set type of column to hidden ?

jexcel(document.getElementById('spreadsheet'), {
    data:data,
    columns: [
        {
            type: 'text',
            title:'Car',
            width:90
        },
        {
            type: 'dropdown',
            title:'Make',
            width:120,
            source:[
                "Alfa Romeo",
                "Audi",
                "Bmw",
                "Chevrolet",
                "Chrystler",
                "Dodge",
                "Ferrari",
              ]
        },
        {
            type: 'hidden',
        },
     ]
});

Or defined style with Jquery Selector $( 'table.jexcel tr td[data-x="0"]').css( "display", "none" );

0 is an index of column

VictorCandido commented 4 years ago

The problem in setting the column hidden is that I need the event to be dynamic. I need to set hidden in some cases and other cases be visible. Is there a way to do that?

I'm already doind with jQuery "$( 'table.jexcel tr td[data-x="0"]').css( "display", "none" );", but the problem is that I have a lot custom css on the cells, rows and columns... When I hide the column with this function of jQuery, I destroy all my CSS, so I need to recreate almoast everything.

GBonnaire commented 4 years ago

In JExcel, when you set to hidden a column, you set display:none on this column. you give same problem.

can you test with visibilty:hidden and/or width: 0px ?

pphod commented 4 years ago

I have created some new methods to dynamically show and hide columns.

table.showColumn(colNumber); // the first column is column 0 table.hideColumn(colNumber); // the first column is column 0

VictorCandido commented 4 years ago

Thank you so much!! That's what I needed

debamishra14 commented 4 years ago

@paulhodel @Guillaume-Bo can you guys please comment on issue: https://github.com/paulhodel/jexcel/issues/1162

Louise-Huang commented 3 years ago

@pphod Is there any method could hide rows just like hideColumn() ?

Louise-Huang commented 3 years ago

I tried to use table.hideRow(rowNum). It seems that there is this method, but no matter what the rowNum is, only the first row will be hidden.

GBonnaire commented 3 years ago

Hi,

i tried, and hideRow hide the complet row not only first column. 0 = first row

Can you reproduct error on jsfiddle ?

Louise-Huang commented 3 years ago

@GBonnaire

Hi, here is my codepen. https://codepen.io/LouiseHuang/pen/oNWbjrX

GBonnaire commented 3 years ago

Hi, ty

Ok problem is on version Pro. For support for version pro is here : https://github.com/jspreadsheet/pro/issues

I inform team of development of this bug thanks

Louise-Huang commented 3 years ago

Hi,

Oh, I'm so sorry that I didn't find this page is support for version CE. Anyway, thank you so much.

GBonnaire commented 3 years ago

Don't worries, here we help for version Pro too, but i'm not dev of JSS Pro, only Dev plugins of JSS Pro and i help here when i can 😊 And for bug like this, on page support, Team dev see easier the problems 😊

Have good day

Louise-Huang commented 3 years ago

Hi, I take the liberty to ask, when will this method be fixed in version pro? Because I'm a bit urgent. Thank you.

hodeware commented 3 years ago

That will be fixed today.

Louise-Huang commented 3 years ago

@hodeware Awesome! Thank you so much! 😄

hodeware commented 3 years ago

It has been fixed. v7.9.20+

Louise-Huang commented 3 years ago

@hodeware First of all, thank you for quickly solving my problem, hideRow can be used normally, but I found that showRow seems to be unavailable. Could you please fix it again? Thank you so much.

hodeware commented 3 years ago

Hi Louise, Both methods are available. hideRow, showRow

Are you using Pro?

Louise-Huang commented 3 years ago

Hi Paul, Yes, I do use pro v7. And I really can not use showRow 😢

https://codepen.io/LouiseHuang/pen/oNWbjrX

hodeware commented 3 years ago

Please try again: https://jsfiddle.net/w0co5ngv/

Louise-Huang commented 3 years ago

It's available! Thank you so much.

chepo92 commented 2 years ago

hideColumn doesn't hide respective cell in footer