Telerik Forums
Kendo UI for Angular Forum
0 answers
117 views
0

Below is my code snippet.

string query = $@" select name from inventory where id = @p1;

Var data=mycontext.Database.SqlQuery(query,typeid); Var returndata =data.ToDataSourceResult(request);

Here inventory is the view which contains around 262 columns and myclass is the corresponding c# class which contains the variable for view. I m getting data from db within seconds. But this ToDataSourceResult is taking very long time. Can anyone please help me on this. I cant make any changes to this view columns

Aswini
Top achievements
Rank 1
 asked on 11 Oct 2023
1 answer
341 views

Following code (shortened for simplicity):

<kendo-fileselect
  id="files"
  formControlName="files"
  [restrictions]="this.fileRestrictions"
  (select)="onFileSelect($event)">
  <ng-template kendoFileSelectFileInfoTemplate let-files>
---- shows name and validationerrors ----
  </ng-template>
</kendo-fileselect>

  async onFileSelect(ev: SelectEvent) {
    ev.files.forEach(currentFile => {
      if (currentFile.rawFile) {
        this.readFile(currentFile.rawFile).then(content => {
            let attachment = (<AttachmentModel>{filename: currentFile.name, content: content});
            this.attachmentClient.isValid(attachment, this.tenant).subscribe(
              isValid => {
                if (!isValid) {
                  currentFile.validationErrors = currentFile.validationErrors ?? [];
                  currentFile.validationErrors.push("malwareFound");
                } } ); } ); }  });  }

Explaination: I'm checking for malware here (via this.attachmentClient.isValid on server-side).

My problem: It shows the validationerror, but still adds the file to value of the control. For example it doesn't add a file with a wrong extension (restricted via kendo-fileselect restrictions) How can I set my malware-file to not end up in value? I've tried ev.preventDefault(), but this removes the file completely from the list (and I don't see the validationerror)

Screenshot:

- first file: not allowed filetype -> is not in value of control

- second file: malware -> is still in value of control

 

Regards

Stefani
Telerik team
 answered on 10 Oct 2023
0 answers
107 views

Hi  Team,

I aim to create a separate component dedicated to the toolbar within a Kendo Grid. To achieve this, I've created a `ToolbarComponent`. In the parent component's Kendo Grid, I'm utilizing an `ng-container` to include it within the 'kendoGridToolbarTemplate'. Nevertheless, the styles are not being applied as expected. Specifically, the `kendo-grid-spacer` in the toolbar component is not functioning as anticipated. Can you please provide me a sample

parent component

    <kendo-grid
      [kendoGridBinding]="eduList"
      kendoGridSelectBy="id"
      [pageSize]="pageSize"
      [pageable]="{ type: 'numeric', position: 'top' }"
      [sortable]="true"
      [groupable]="false"
      [reorderable]="true"
      [resizable]="true"
      filterable="menu"
      [skip]="skip">

      <ng-template kendoGridToolbarTemplate>
        <ng-container [ngComponentOutlet]="toolbarComponent | async"></ng-container>
        <!-- <div>a</div> <kendo-grid-spacer></kendo-grid-spacer> <div>b</div> -->
      </ng-template>

      <kendo-grid-column field="id" title="#" headerClass="t-text-primary" [width]="50" [filterable]="false">
        <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
          <div class="customer-number">{{ rowIndex + 1 }}</div>
        </ng-template>
      </kendo-grid-column>

      <kendo-grid-column field="" title="" [width]="50" [filterable]="false">
        <ng-template kendoGridCellTemplate let-dataItem>
          <!-- Template for the first column -->
          <kendo-button fillMode="clear" icon="edit"> </kendo-button>
        </ng-template>
      </kendo-grid-column>

      <kendo-grid-column
        headerClass="t-text-primary"
        field="Name"
        title="Name"
        [width]="200">
      </kendo-grid-column>

      <kendo-grid-column
        headerClass="t-text-primary"
        field="Age"
        title="Age"
        [width]="150">
      </kendo-grid-column>


      <kendo-grid-column
        headerClass="t-text-primary"
        field="Edu"
        title="Education"
        [width]="150">
      </kendo-grid-column>

  </div>

 

export class EduListComponent {
  public toolbarComponent = import(
    '../toolbar/toolbar.component'
  ).then(({ oolbarComponent }) => ToolbarComponent)

  constructor(
    private router: Router,
    private cdr: ChangeDetectorRef
  ) {}

}

child component:-

<button kendoButton fillMode="outline" class="t-capitalize !t-border-[#ccc]">
  Create doc
</button>
<kendo-grid-spacer></kendo-grid-spacer>
<button kendoButton fillMode="outline" class="t-capitalize !t-border-[#ccc]">
  Delete doc
</button>            
sat
Top achievements
Rank 1
 updated question on 09 Oct 2023
1 answer
740 views
Do you have any guidance on activating Kendo UI licenses for Angular in a docker build?
Martin Bechev
Telerik team
 answered on 09 Oct 2023
0 answers
117 views

Does Kendo Scheduler for Angular with custom dates range

multiple months examples 1,2,3 months view at same time.

(And does it support multiple months examples 1,2,3 months view at same time.)

And also can we custom the start and end dates. As of now I only the 1 week for custom dates.

Can you please help.

Alamo
Top achievements
Rank 1
 asked on 08 Oct 2023
0 answers
115 views
As of R3 2023 release, the font icons are detached from the themes css files. If you are still using font icons, make sure to include a reference to the font icons in your applications. You can read more information about the change in the following blog post: https://www.telerik.com/blogs/future-icons-telerik-kendo-ui-themes. It contains essential information about the change for all products and migration articles to svg icons.
Telerik Admin
Top achievements
Rank 1
Iron
 asked on 06 Oct 2023
1 answer
393 views

Hi , 

I am using the Kendo Grid to display some data with checkboxes , I am trying to checked the item checkbox if the item is already selected , the selected item id is store on a separate sql table .

The process is ;  load items , load selected items , add selected items to selectedKeys.

for some reason the first time the page is loaded selectedKeys is empty , but if a navigate to another page and back to the page the selected items are checked.

I can only assume the selectedKeys are not populated on time for the grid to update the checkboxes , I have try NgOnInit , ngAfterViewInit. 

Any Ideas ? 

 

HTML

 <kendo-grid [data]="gridData" 
    (dataStateChange)="dataStateChange($event)" 
    [filterable]="true"
    [filter]="state.filter"
    [sortable]="true"
    [sort]="state.sort"
    [pageSize]="20"
    [pageable]="true"
    kendoGridSelectBy="codeNumber"
    [selectedKeys]="selectedCodes"
    (selectionChange)="onSelect($event)"
    [selectable]="selectableSettings">
       
        <kendo-grid-column field="codeNumber" title="Code Number"> </kendo-grid-column>
        <kendo-grid-checkbox-column title="Use on Project"></kendo-grid-checkbox-column>
        
    </kendo-grid>

TS 

export class PackageCodesMasterListComponent implements OnInit, AfterViewInit {

    public gridData: GridDataResult;
    packageCodes: PackageCode[] = [];
    item: PackageCode;
    packageCodeTypes: PackageCodeType[];
    public selectedCodes: string[] = [];
    projectPackageCodes: ProjectPackageCode[] = [];

    public mode: SelectableMode = "multiple";

    constructor(private store: Store<IPackageCodeState>, private coreStore: Store<AppState>, private router: Router) {
        combineLatest(this.store.pipe(select(selectPackageCodes)), this.store.pipe(select(selectProjectPackageCodes)), this.store.pipe(select(selectPackageCodeTypes))).subscribe(([packageCodes, projectPackageCodes, packageCodeTypes]) => {
            if (packageCodes && projectPackageCodes && packageCodeTypes) {
                this.packageCodes = packageCodes;
                this.projectPackageCodes = projectPackageCodes;
                this.packageCodeTypes = packageCodeTypes;

                if (this.projectPackageCodes.length > 0) {
                    this.findSelectedItems();
                }
                this.gridData = process(this.packageCodes, this.state);
            }
        })
    }

    ngOnInit(): void {
        this.store.dispatch(getPackageCodes())
        this.store.dispatch(getPackageCodeTypes())
        this.store.dispatch(getProjectPackageCodes())
    }

    public ngAfterViewInit() {
        //Custom logic could be added here, to be executed once the grid and the selection are loaded
        this.findSelectedItems();
    }

    public state: State = {
        sort: [{ field: "codeNumber", dir: "asc" }],
        group: [],
        filter: {
            logic: "and",
            filters: [],
        },
    };

    public selectableSettings: SelectableSettings = {
        enabled: true,
        mode: this.mode
    };

    public dataStateChange(state: DataStateChangeEvent): void {
        this.state = state;
        this.gridData = process(this.packageCodes, this.state);

    }

    findSelectedItems() {
        if (this.projectPackageCodes.length > 0) {
            this.projectPackageCodes.forEach(item => {

                let code = this.packageCodes.find(x => x.packageCodeId === item.packageCodeId)
                let y = this.selectedCodes.includes(code.codeNumber)
                if (y === false) {
                    this.selectedCodes.push(code.codeNumber);
                    console.log(this.selectedCodes.length)
                }
            })
        }
    }

Hernando
Top achievements
Rank 1
Iron
Iron
 updated answer on 05 Oct 2023
1 answer
165 views

https://www.telerik.com/kendo-angular-ui/components/charts/drill-down/

 

Error: src/app/dashboard/dashboard.component.html:20:23 - error TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{ "Company A": { product: string; sales: number; }[]; "Company B": { product: string; sales: number; }[]; }'.

20               [data]="productData[company]"
                         ~~~~~~~~~~~~~~~~~~~~
 
Martin Bechev
Telerik team
 answered on 05 Oct 2023
1 answer
223 views

I am using kendo Multiview calendar .I am expecting that when I click on any of the Weeknumber, complete week should be selected . Kindly help on this . Is there any click event available ?

Martin Bechev
Telerik team
 answered on 04 Oct 2023
1 answer
289 views

I am using kendo Multiview calendar . Current implementation is the start day of the week is from Sunday.
I need to make start day of the week as Monday .Kindly help on this

My sample code :

 <kendo-daterange>
                <div class="row">
                  <div class="col-md-6">
                    <kendo-floatinglabel text="Start">
                      <kendo-dateinput kendoDateRangeStartInput [min]="minDate" [(value)]="range.start"></kendo-dateinput>
                    </kendo-floatinglabel>
                  </div>
                  <div class="col-md-6">
                    <kendo-floatinglabel text="End">
                      <kendo-dateinput #endDateInput kendoDateRangeEndInput [max]="maxDate" [(value)]="range.end"></kendo-dateinput>
                    </kendo-floatinglabel>
                  </div>
                </div>
              
                <kendo-daterange-popup>
                  <ng-template kendoDateRangePopupTemplate>
                    <kendo-multiviewcalendar kendoDateRangeSelection [selectionRange]="range" [weekNumber]="true"
                      (selectionRangeChange)="handleSelectionRange($event)">
                
                      <ng-template kendoCalendarWeekNumberColumnTemplate  let-context="cellContext">
                        <span class="weeknumber-cell">{{context.formattedValue}}</span>
                      </ng-template>
                    </kendo-multiviewcalendar>
                  </ng-template>
              
                </kendo-daterange-popup>
    </kendo-daterange>

Martin Bechev
Telerik team
 answered on 04 Oct 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?