1

I am using Kendo UI with Angular 5. And I wanted to use Kendo's Multiselect component to enable user insert custom text values. By default, this component lists dropdown options or displays "No data found" message, if no dropdown data is present.

In my case, their is no dropdown data. And unnecessary to display the No-Data Template. Can anyone please tell me any possibility to disable/hide the No-Data Template?

<kendo-multiselect
 formControlName="emails"
 [value]="selectedEmails"
 [allowCustom]="true"
 (valueChange)="onEmailsChange($event)" >                            
</kendo-multiselect>

Thanks in advance.

4 Answers 4

1

If you don't want the "No Data found" message, you can use the kendoMultiSelectNoDataTemplate and keep it empty

<kendo-multiselect [data]="listItems">
   <ng-template kendoMultiSelectNoDataTemplate>
   </ng-template>
</kendo-multiselect>

Plunkr

Sign up to request clarification or add additional context in comments.

1 Comment

I have tried that. But have you noticed the blank dropdown box when making kendoMultiSelectNoDataTemplate empty ? My goal is only to show custom values added in that dropdown.
1

You can also add a custom class to the popup and hide it with CSS. Here's an example that appends the class .k-custom-popup--hidden when emails is empty.

HTML

<kendo-multiselect
 formControlName="emails"
 [value]="selectedEmails"
 [allowCustom]="true"
 (valueChange)="onEmailsChange($event)"
 [data]="listItems"
 [popupSettings]="{popupClass: !emails.length ? 'k-custom-popup--hidden' : ''}">                            
</kendo-multiselect>

CSS (Global)

.k-custom-popup--hidden {
 display: none;
}

Comments

0

In case anyone is looking for similar feature, I have got response from Telerik team. The No-Data Template can be hidden using CSS having set ViewEncapsulation to none.

import { Component, ViewEncapsulation } from '@angular/core';

@Component({
   selector: 'my-app',
   template: `
      <div class="example-config">
      Current value: {{value | json}}
      </div>
      <div class="example-wrapper">
      <p>Favorite sport:</p>
      <kendo-multiselect 
         [allowCustom]="true"
         [(ngModel)]="value" >
      </kendo-multiselect>
      </div>`,
   styles:[`
     .k-nodata, .k-nodata .ng-star-inserted {  display: none   }
   `],
   encapsulation: ViewEncapsulation.None
})
export class AppComponent {
    public value;
}

Comments

0

You can use kendo-multiselect-messages tag to change the text.

Example :

<kendo-multiselect
  [data]="[items]">
  <kendo-multiselect-messages noDataText="No data on XXXXX"></kendo-multiselect-messages>
</kendo-multiselect>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.