public data: { [key: string]: Object }[] = [
{ text: 'Settings', iconCss: 'e-list-icons e-list-user-settings' },
{ text: 'Address Book', iconCss: 'e-list-icons e-list-address-book' },
{ text: 'Delete', iconCss: 'e-list-icons e-list-delete' },
{ text: 'Forward', iconCss: 'e-list-icons e-list-forward' },
{ text: 'Reply', iconCss: 'e-list-icons e-list-reply' },
{ text: 'Reply All', iconCss: 'e-list-icons e-list-reply-all' },
{ text: 'Save All Attachments', iconCss: 'e-list-icons e-list-save-all-attachments' },
{ text: 'Save As', iconCss: 'e-list-icons e-list-icon-save-as' },
{ text: 'Touch/Mouse Mode', iconCss: 'e-list-icons e-list-touch' },
{ text: 'Undo', iconCss: ' e-list-icons e-list-undo' }
];
public setfield = {
iconCss: "iconCss"
} |
<div id="listbox-selection">
<h4>Select your favorite car:</h4>
<ejs-listbox [dataSource]="data" [allowFiltering]="true" [fields]="setfield"></ejs-listbox>
</div> |
<div class="col-lg-12 control-section">
<div id="listbox-control">
<h4>Select your favorite car:</h4>
<ejs-listbox id='listbox' #listbox [dataSource]='data' height='330px' [sortOrder]='Ascending' (created)='created ($event)'></ejs-listbox>
</div>
</div>
<div id="hide">
<span id="mySpan"></span>
</div> |
export class AppComponent implements OnInit {
@ViewChild('listbox') public listObj: ListBoxComponent;
ngOnInit() {
}
ngAfterViewInit(){
//Initialize Tooltip component
this.tooltip = new Tooltip({
// default content of tooltip
content: 'Loading...',
// set target element to tooltip
target: '.e-custom-tooltip',
// bind beforeItemRender event
beforeRender: this.onBeforeRender
});
this.tooltip.appendTo('body');
}
created(): void {
this.addCustomClass();
}
addCustomClass():void{
debugger
let listLi = document.querySelectorAll(".e-list-item")
let i: number;
for ( i = 0; i < listLi.length; i++) {
var mySpan = document.getElementById("mySpan");
mySpan.innerText = listLi[i].innerText;
listLi[i].classList.add("e-custom-tooltip")
}
}
} |