Page 1 of 1

Hide Data Table Column

Posted: 19 Dec 2018, 13:28
by JBottomley

Is there anyway I can hide a DataTable column but still have a DataTable globalFilter search within that column?

Thanks in advance

Re: Hide Data Table Column

Posted: 20 Dec 2018, 13:47
by merve7
You can use 'style' prop for Column component, like the below code;

Code: Select all

        let header = <div style={{'textAlign':'left'}}>
                            		<i className="pi pi-search" style={{margin:'4px 4px 0 0'}}></i>
                           		 <InputText type="search" onInput={(e) => this.setState({globalFilter:})} placeholder="Global Search" size="50"/>

Code: Select all

                    <DataTable globalFilter={this.state.globalFilter} value={} header={header}>
                        <Column field="vin" header="Vin"/>
                        <Column field="year" header="Year" />
                        <Column field="brand" header="Brand" />
                        <Column field="color" header="Color" style={{display:'none'}}/>