Telerik Forums
Kendo UI for Angular Forum
1 answer
525 views

I'm a beginner and i tried to create a pie chart using json data. but this code does not shows any error and it does not show the chart also.

component.ts file is here

 

 import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
  export class pieData {
  constructor(
    public kind: string,
    public share: number,
  ) {}
}

@Component({
  selector: 'app-pie-chart',
  templateUrl: './pie-chart.component.html',
  styleUrls: ['./pie-chart.component.css']
})
export class PieChartComponent implements OnInit {

  pieData: pieData[];
  constructor(private httpClient: HttpClient) {}
      ngOnInit() {
    this.getpieData();
  }
      getpieData() {
        this.httpClient.get<any>('../db.json').subscribe(
      Response => {
        console.log(Response);
        this.pieData = Response;
      }
    );

    console.log(this.pieData);
  }
}

 

component.html file is here

<kendo-chart [transitions]="false" [style.height]="'100%'" [style.width]="'100%'">
  <kendo-chart-tooltip format='{0}%'></kendo-chart-tooltip>
  <kendo-chart-series>
    <kendo-chart-series-item type="pie"
                             [data]="pieData?.pieData"
                             categoryField="kind"
                             field="share"
                             *ngIf="pieData">
      <kendo-chart-series-item-labels [align]="labelAlign"
                                      color="#000"
                                      [content]="labelContent">
      </kendo-chart-series-item-labels>
    </kendo-chart-series-item>
  </kendo-chart-series>
  <kendo-chart-legend [visible]="false"></kendo-chart-legend>
</kendo-chart>

 

db.json file is here

"pieData": [ { "id": 1, "kind": "Solar", "share": 5 }, { "id": 2, "kind": "Wind", "share": 2 }, ]

 

Martin Bechev
Telerik team
 answered on 09 Feb 2022
1 answer
239 views

Hi

 

Could i select or disable an "kendo-tabstrip-tab" by name or not with index number ?

 

Regards

Martin Bechev
Telerik team
 answered on 09 Feb 2022
1 answer
1.0K+ views

Hi,

 

We are using kendo grid with editable inputs. Once all the columns in the row is selected and the user tabs out of the last field, we need an event so we  the fields can be validated. Right now, I do not see any evens that I can use.  We have to either add a new row or save to do the validations.

This is cumbersome. It would be great if we somehow have an even to know that the particular row lost focus.

Regards,

Jyothi

Dimiter Topalov
Telerik team
 answered on 09 Feb 2022
1 answer
1.5K+ views
Is there a way to disable stepper functionality and keep same styling as before disabling? 
So to be more specific I want stepper to look like this


But the user click functionality should be disabled.

I've tried with disabled property but it grays out whole stepper.

Thanks,
Sasa
Preslava
Telerik team
 answered on 09 Feb 2022
0 answers
278 views

I use many grids throughout our application each have sorting and paging turned on and therefore instead of binding to the pageChange and sortChange events I bind to the dataStateChangeEvent. My grids are pretty much all set up the same whereby I bind the skip and sort to a kendo grid state object...example:


<kendo-grid
    #nameSearchResults
    [data]="gridDataResult"
    [loading]="isSearching"
    [pageSize]="state.take"
    [pageable]="{
      buttonCount: 5,
      info: true,
      type: pageableType,
      pageSizes: pageSizes,
      previousNext: true,
      position: 'both'
    }"
    [skip]="state.skip"
    [sort]="state.sort"
    [sortable]="true"
    [filter]="state.filter"
    filterable="menu"
    [resizable]="true"
    [reorderable]="true"
    [columnMenu]="true"
    [filterable]="showFilterMenu"
    (dataStateChange)="dataStateChange($event)"
    (columnResize)="onColumnResized($event)"
    (columnReorder)="onColumnReorder($event)"
    (columnVisibilityChange)="onColumnVisibilityChange($event)"
    [selectable]="selectableSettings"
    (selectionChange)="onNameSelectionChange($event)"
    (cellClick)="onGridCellClick($event)"
    kendoGridSelectBy="nameId"
    [(selectedKeys)]="selectedKeys"
  >


public gridDataResult: GridDataResult;
public pageableType: 'input' | 'input' = 'input';
public selectableSettings = this.isDialog  ? 'single' : 'multiple';
public state: State = {
    skip: 0,
    take: 100,
    sort: [ {field: 'scientificName', dir: 'asc'  } ]
  };

Inside the datastateChange event I first set the state to the state object passed to me and then perform a search which calls out to the server to get data.


dataStateChange(state: DataStateChangeEvent): void {
    this.state = state;
    if (this.gridDataResult && this.gridDataResult.total > 0) {
      this.searchRequest.sortColumns = this.getGridSortColumns(this.state.sort);
      this.searchRequest.currentPage = (this.state.skip / this.state.take);
      this.searchRequest.pageSize = this.state.take;
      this._search();
    }
    
  }
The problem that I am seeing is that as soon as I set the state object, then the datastatechange event gets called a second time causing the code to make a second call to the server to get data. My grids have been coded this way for quite some time and I know that I was not getting this effect at an earlier date. I do not know what broke it but I just noticed this since my last update to the kendo packages. Has anyone else noticed this behavior? If so, is there a fix for it?
schakravarty
Top achievements
Rank 2
Iron
Iron
 asked on 08 Feb 2022
4 answers
889 views

My app is currently using snapshot testing via Jest for a large amount of tests. We are running into issues when testing our components with form inputs where kendo inputs (especially the numeric textbox) are being compiled with dynamic ids that are unique every build.

As an example ): 

01.<kendo-numerictextbox
02.     class="k-widget k-numerictextbox ng-untouched ng-pristine ng-invalid"
03.     dir="ltr"
04.     formcontrolname="hours"
05.     id="hours-input"
06.     ng-reflect-format="n0"
07.     ng-reflect-max="24"
08.     ng-reflect-min="0"
09.     ng-reflect-name="hours"
10.     ng-reflect-placeholder="hours">
11.     
12.    <span
13.        class="k-numeric-wrap">
14.        <input
15.          aria-valuemax="24"
16.          aria-valuemin="0"
17.          aria-valuenow=""
18.          autocomplete="off"
19.          autocorrect="off"
20.          class="k-input k-formatted-value"
21.          id="k-eb1c258b-69a0-7f82-72b5-77634a5c7263"
22.          ng-reflect-events="[object Object]"
23.          placeholder="hours"
24.          role="spinbutton"
25.          tabindex="0"
26.          title="" />
27.    </ span>
28.</ kendo-numeric-textbox>

 

As you can see I've added my own id (#hours-input) to the kendo-numerictextbox element but the input element that is nested within the numeric-textbox has a generated id I cannot define (#k-eb1c258b-69a0-7f82-72b5-77634a5c7263). Since the id is generated each time the component is compiled it's different each time the test is run and fails because that id doesn't match the existing snapshot.

I've tried not importing the InputsModule in my test and included a NO_ERRORS_SCHEMA in my test setup but then I get errors because the inputs that the form needs for logic testing aren't created due to the lack of the InputsModule. 

This makes snapshot testing of what's being rendered in our app very difficult. Is there anyway to define what the interior input ids generated or another way we can test inputs in forms without importing the Kendo InputsModule?

 

Jeff
Top achievements
Rank 1
Iron
Iron
 answered on 08 Feb 2022
1 answer
294 views

Hi

I have an tabstrip with many childs components, how could i easly disable all other tabsstrip ?

Regards

Preslava
Telerik team
 answered on 08 Feb 2022
0 answers
90 views

Hi

 

Currently i have an grid with an async service, i search hoiw selected first row ?

 

Regards

 

Masip
Top achievements
Rank 1
Iron
 asked on 08 Feb 2022
0 answers
62 views
0 answers
90 views

Hi,

there is this link how to do the above mentioned task:

https://www.telerik.com/kendo-angular-ui/components/uploads/upload/model-binding/#toc-rendering-of-initial-files

In my special case the file isn't rendered.

I have a multistep form with a stepper, where I pass the form variable as input variable to the appr. step screen. The workflow is the following: the user fills in some data on the first screen, then selects a file on the second screen, reviews it on the 3rd screen and if everything is ok, uploads it on the last screen.

This is the code detail of the form:

<form class="k-form" [formGroup]="form" style="margin-top: 2rem">
    <entity
      *ngIf="currentStep === 0"
      [entity]="currentGroup"
      [formPassed]="entityFormPassed"
    >
    </entity>
    <file *ngIf="currentStep === 1" [file]="currentGroup"> </file>
    <overview *ngIf="currentStep === 2" [form]="form"></overview>
    <upload-file *ngIf="currentStep === 3" [form]="form"></upload-file>
  </form>

The form variable contains the file, which I would like to upload as a last step.

My upload-file component looks like this:

<kendo-upload [ngModel]="fileArray"> </kendo-upload>

TS:


import { Component, Input, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { FileInfo } from '@progress/kendo-angular-upload';

@Component({
  selector: 'upload-file',
  templateUrl: './upload-file.component.html',
})
export class UploadFileComponent implements OnInit {
  @Input() form!: FormGroup;

  fileArray!: FileInfo[];

  ngOnInit() {
    this.fileArray = <FileInfo[]>this.form.get('file.fileName')?.value;
  }
}

I get the file correctly, it has the appr. value. But the file isn't rendered in the file list of the upload component. If I directly declare the fileArray variable with some test files, it works. The question is, how to get rendered the file, which was provided via input property?

I have another question too.

In your examples to the upload component you use a mock service to simulate the upload process and this changes the progressbar value too.

In my case - as described above - the user will start the upload. Do I need to care about changing the progress bar value somehow via the uploadprogress event or the component cares itself about it? If no, how can I do this?

Thanks for your help.

josh
Top achievements
Rank 1
 asked on 07 Feb 2022
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?