The following example demonstrate about how to disable the Fixed group header in DropDownList through CSS by using visibility
attribute.
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
// specifies the template string for the DropDownList component
template: `<ejs-dropdownlist id='ddlelement' #samples [dataSource]='data' [fields]='fields' [placeholder]='text' [popupHeight]='height'></ejs-dropdownlist>`,
styleUrls: ['index.css']
})
export class AppComponent {
constructor() {
}
// defined the array of data
public data: { [key: string]: Object }[] = [
{ Vegetable: 'Cabbage', Category: 'Leafy and Salad', Id: 'item1' },
{ Vegetable: 'Spinach', Category: 'Leafy and Salad', Id: 'item2' },
{ Vegetable: 'Wheat grass', Category: 'Leafy and Salad', Id: 'item3' },
{ Vegetable: 'Yarrow', Category: 'Leafy and Salad', Id: 'item4' },
{ Vegetable: 'Pumpkins', Category: 'Leafy and Salad', Id: 'item5' },
{ Vegetable: 'Chickpea', Category: 'Beans', Id: 'item6' },
{ Vegetable: 'Green bean', Category: 'Beans', Id: 'item7' },
{ Vegetable: 'Horse gram', Category: 'Beans', Id: 'item8' },
{ Vegetable: 'Garlic', Category: 'Bulb and Stem', Id: 'item9' },
{ Vegetable: 'Nopal', Category: 'Bulb and Stem', Id: 'item10' },
{ Vegetable: 'Onion', Category: 'Bulb and Stem', Id: 'item11' }];
// maps the appropriate column to fields property
public fields: Object = { groupBy: 'Category', text: 'Vegetable', value: 'Id' };
// set the placeholder to the DropDownList input
public text: string = "Select a vegetable";
// Set the popup list height
public height: string = '200px';
}
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { DropDownListModule } from '@syncfusion/ej2-angular-dropdowns';
/**
* Module
*/
@NgModule({
imports: [
BrowserModule,FormsModule, DropDownListModule
],
declarations: [AppComponent],
bootstrap: [AppComponent]
})
export class AppModule { }
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { AppModule } from './app.module';
enableProdMode();
platformBrowserDynamic().bootstrapModule(AppModule);
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js"></script>
<title>Angular DropDownList</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript Toolbar Controls" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<!-- Here we have used CDN links for our preview purpose -->
<link href="//cdn.syncfusion.com/ej2/20.4.38/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.38/ej2-base/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.38/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.38/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.38/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/20.4.38/ej2-buttons/styles/material.css" rel="stylesheet" />
<script src="https://unpkg.com/core-js@2.6.5/client/shim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.6.25/zone.min.js"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.3"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
</head>
<body>
<div id="wrapper" style='margin-top: 20px'>
<app-root>
<div id='loader'>LOADING....</div>
</app-root>
</div>
</body>
</html>
#container {
visibility: hidden;
}
#loader {
color: #008cff;
height: 40px;
width: 30%;
position: absolute;
top: 45%;
left: 45%;
}
#wrapper {
width: 250px;
margin: 0 auto;
}
.e-ddl .e-dropdownbase .e-fixed-head {
visibility: hidden;
}