Telerik Forums
Kendo UI for Angular Forum
1 answer
133 views

Whenever i tried to key in a negative sign "-", followed by a zero. the grid filter will automatically change it to zero.

how can i prevent it from automatically changing?

need to maintain a numeric filter, (no letters allowed)

 

Code:

<kendo-grid-column field="xx" title="xx">
<ng-template kendoGridFilterCellTemplate let-filter let-column="column">
<kendo-grid-numeric-filter-cell
[showOperators]=false
[column]="column">
</kendo-grid-numeric-filter-cell>
....
<kendo-grid-column>

Veselin
Telerik team
 answered on 02 Mar 2023
1 answer
575 views

I have three layer object: there is several departments, Department have multiple categories and category have multiple subCategories:

I am using [checkBy]="checkBy" in html page

Html code of tree view:

 [nodes]="refinedProducts"
                [children]="children"
                [hasChildren]="hasChildren"
                [textField]="['Department', 'Category', 'SubCategory']"
                [checkedKeys]="checkedKeys"
                (valueChange)="handleProductChecking($event)"
                [checkBy]="checkBy"

 

and methods in ts file

public checkBy(item: TreeItem) {

     return item.dataItem;     

}  

public handleProductChecking(checkedKeys: any): void {

//checkedKeys coming as object - that as per my requirement

}

 

 

if I removed the [checkBy]="checkBy"

from html than parent coming checked when i checking any child item but handleProductChecking

returns the array of indexes like [0_1_2] while I need object for my requirement, 

conclusion of my requiremnt is - parent should be checked(with hypen) when I checked in any child and handleProductChecking

return the object rather than array of indexes.

 

 

Martin Bechev
Telerik team
 answered on 02 Mar 2023
0 answers
160 views

Hi,

  I checked the demo for Angular kendo-grid persist state at this url: https://www.telerik.com/kendo-angular-ui/components/grid/persist-state/

  The demo is good and it works for simple columns, because it's using *ngFor to generate columns in the grid.

  Is it possible to have persist state for grid with custom columns?  For example, I have following columns in my grid:

<kendo-grid-column field="{{ 'category.field' | translate }}" title="{{ 'grid.category' | translate }}" [width]="150">
  <ng-template kendoGridCellTemplate let-dataItem>
	<span *ngIf="dataItem.category.id === CATEGORY.LIVINGROOM">
		Some custom code here

	</span>
	<span *ngIf="dataItem.category.id !== CATEGORY.LIVINGROOM">
		Some cusotm code here
	</span>
  </ng-template>
</kendo-grid-column>

<kendo-grid-column field="{{ 'subCategory.field' | translate }}" title="{{ 'grid.subCaregory' | translate }}" [width]="150">
  <ng-template kendoGridCellTemplate let-dataItem>
	<span *ngIf="dataItem.subCategory.id === SUBCAREGORY.SOFA">
		Some custom code here

	</span>
	<span *ngIf="dataItem.subCategory.id !== SUBCAREGORY.SOFA">
		Some cusotm code here
	</span>
  </ng-template>
</kendo-grid-column>

  If there is a way to use persist state for grid with custom columns, can you provide some code sample?

Thanks,

Taichi

 

 

 

Domamu
Top achievements
Rank 1
 asked on 01 Mar 2023
2 answers
1.0K+ views

We are trying to create multi select component with remote data (with paging) and virtual scroll to use it in grid menu filters. Unfortunately, there are few problems:

1) When I pass selected items from parent component everything that is not in loaded items is ignored (no tags presented) even if I set allowCustom to true. Loading entire data set is not an option for us, amount of data is too large.


2) Selected items are shown incorrect. It selects wrong items, seems the problem is in virtual scroll. Is there any possibility (any attribute?) to control selected items in our code?

3) Checkbox sometimes selects more than one item.


Code example: 
HTML:

<kendo-multiselect
  [data]="items"
  [valuePrimitive]="true"
  [virtual]="virtual"
  [filterable]="true"
  [allowCustom]="true"
  [checkboxes]="true"
  [tagMapper]="tagMapper"
  [kendoMultiSelectSummaryTag]="3"
  [popupSettings]="popupSettings"
  [loading]="isLoading"
  [autoClose]="false"
  valueField="id"
  textField="id"
  (valueChange)="onChange($event)"
  (opened)="onOpened()"
  (filterChange)="onFilterChange($event)"
>
  <ng-template kendoMultiSelectHeaderTemplate>
    <div class="k-grid-header">
      <div class="k-grid-header-wrap">
        <table class="multi-select-headers-grid">
          <thead>
            <tr>
              <th
                *ngFor="let col of columns"
                class="k-header"
                [style.width.px]="defaultColumnWidth"
              >
                {{ col.label }}
              </th>
            </tr>
          </thead>
        </table>
      </div>
    </div>
  </ng-template>
  <ng-template kendoMultiSelectItemTemplate let-item>
    <ng-container *ngFor="let col of columns">
      <ng-container *ngIf="item">
        <span class="k-cell" [style.width.px]="defaultColumnWidth">{{ item[col.propName] }}</span>
      </ng-container>
    </ng-container>
  </ng-template>
  <ng-template kendoMultiSelectGroupTagTemplate let-dataItems>
    {{ dataItems.length }} more selected
  </ng-template>
</kendo-multiselect>


TS:


  items: MultiSelectItem[] = [];
  isLoading: boolean = false;
  popupSettings: PopupSettings = { width: 500 };
  readonly defaultColumnWidth = 200;

  state: any = {
    skip: 0,
    take: 10,
  };

  virtual: VirtualizationSettings = {
    itemHeight: 36,
    pageSize: 10,
    total: 0,
  };

  private term: string;
  private stateChange = new BehaviorSubject<any>(this.state);
  private unsubscribe = new Subject();

  @Output() selectionChange: Subject<string[]> = new Subject();
  @Output() termChange: Subject<Term> = new Subject();

  @ViewChild(MultiSelectComponent, { static: false })
  multiSelect: MultiSelectComponent;

  ngOnInit(): void {
    this.stateChange
      .pipe(skip(1), debounceTime(50), takeUntil(this.unsubscribe))
      .subscribe(state => {
        this.state = state;
        this.isLoading = true;
        this.emitTermChanged();
      });

    this.dataSource
      .pipe(takeUntil(this.unsubscribe))
      .subscribe(response => this.onResponse(response));
  }

  ngOnDestroy(): void {
    this.unsubscribe.next();
  }

  ngAfterViewInit() {
    this.multiSelect.tags = this.selectedItems;
    console.log('this.multiSelect.tags: ', this.multiSelect.tags);
  }

  onChange(value) {
    this.selectedItems = value;
    this.selectionChange.next(this.selectedItems);
  }

  onOpened(): void {
    this.multiSelect.optionsList.pageChange.subscribe(state => {
      this.stateChange.next(state);
    });
  }

  onFilterChange(searchTerm: string): void {
    this.term = searchTerm;
    this.emitTermChanged();
  }

  tagMapper = (tags: any) => {
    return this.selectedItems;
  };

  private emitTermChanged() {
    this.termChange.next({
      value: this.term,
      offset: this.state.skip,
      size: this.state.take,
    });
  }

  private onResponse(response: any): void {
    if (this.virtual.total !== response.totalAmount) {
      this.items =
        response.totalAmount > response.result.length
          ? response.result.concat(new Array(response.totalAmount - this.state.take))
          : [...response.result];
    } else {
      this.items.splice(this.state.skip, this.state.take, ...response.result);
    }

    this.virtual.total = response.totalAmount;
    this.isLoading = false;
  }
}

export interface MultiSelectItem {
  id: string;
  name: string;
}



Thanks in advance,
Vlad

Nicolas
Top achievements
Rank 1
Iron
 updated answer on 28 Feb 2023
0 answers
148 views

How can I identify the primary scrollbars of the MultiSelect control to be able to modify their appearance?

I have tried to highlight the scrollbar-button so see if I am on the right track with each of these, one-at-a-time:

  • .kc-input-base::-webkit-scrollbar-button:single-button
  • .kc-input-base ::-webkit-scrollbar-button:single-button
  • .kc-input-base > ::-webkit-scrollbar-button:single-button
  • .kc-input-base > ::ng-deep::-webkit-scrollbar-button:single-button
  • .kc-input-base > ::ng-deep.k-multiselect-wrap::-webkit-scrollbar-button:single-button
  • .kc-input-base > ::ng-deep.k-multiselect-wrap ::-webkit-scrollbar-button:single-button
  • ::ng-deep::-webkit-scrollbar-button:single-button


The multiselect is defined as:

        <kendo-label class="k-form k-form-label" text="Coverage">
          <kendo-multiselect
            [data]="coverageCodes"
            formControlName="coverageCode"
            [autoClose]="false"
            [textField]="'name'"
            [valueField]="'key'"
            class="input-search-flex kc-input-base"
            (valueChange)="valueChange($event)"
            [clearButton]="false"
            DropDownFillMode="outline"
            [popupSettings]="{ popupClass: 'kc-popup' }"
          >
          </kendo-multiselect>
        </kendo-label>

This is the result:

 

As you can see, the scrollbars never changed color.

Christopher
Top achievements
Rank 1
 asked on 27 Feb 2023
0 answers
118 views

Hi,

I am having an issue with kendo labels being marked as "orphaned form label" (label was not read by NVDA screen reader) when using the kendo editor with [iframe] set to false to have non-encapsulated style in the Editor. 

The WAVE browser extension does show the "orphaned form label" alert for some of your controls (dropdowns, multiselect) but since you have the aria-label attribute NVDA reads the label text values for those controls.

However, I have noticed that no such aria attribute is added/updated when the [iframe] input of the Editor control is set to false.

I have checked this in your example stackblitz environment and it seems to reproduce the issue as well.



 Is there any workaround to fix this ?

Regards,
Pavithra
Pavithra
Top achievements
Rank 1
 asked on 27 Feb 2023
1 answer
236 views
Hello, 

I am trying to put a max length on the angular autocomplete component to only allow a certain amount of characters to be typed. So far I have had no luck trying to use autocomplete api documentation. 

Hopefully someone is able to help. Thank you in advance.
Veselin
Telerik team
 answered on 24 Feb 2023
1 answer
110 views

Hi,

this is a bug report. The treeview cant' be filtered, if the drag&drop directive is used.

Veselin
Telerik team
 answered on 22 Feb 2023
0 answers
68 views
I'm trying to add Kendo-grid with kendo-popup but am not ably and based on cell click popup will appear 
Tamilvanan
Top achievements
Rank 1
 updated question on 21 Feb 2023
1 answer
85 views
Hi,

I'm having a kendo grid with grouping rows with expand collapse buttons.

When scanned for WCAG, the header column gives an error since it has an empty header without any labels.

Any workaround to fix this?



Thanks & Regards,
Milinda 
Dimiter Topalov
Telerik team
 answered on 21 Feb 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?