![](/img/trans.png)
[英]Disabling specific dates for Kendo UI Datepicker in Angular 2
[英]Kendo UI Angular DatePicker moves scroll position
我已經使用了Kendo UI Angular DatePicker的基本用法示例。
但是,單擊DatePicker時,如果有滾動條,它會煩人地滾動到其他位置以打開DatePicker。
HTML:
<kendo-datepicker ></kendo-datepicker>
package.json如下所示:
"@progress/kendo-angular-dateinputs": "^2.2.0",
"@progress/kendo-angular-intl": "^1.4.0",
"@progress/kendo-angular-l10n": "^1.1.0",
"@progress/kendo-angular-popup": "^2.1.0",
"@progress/kendo-theme-default": "^2.50.0",
App.module.ts:
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { IntlModule } from '@progress/kendo-angular-intl';
import { DateInputsModule } from '@progress/kendo-angular-dateinputs';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
IntlModule,
DateInputsModule,
FormsModule,
ReactiveFormsModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
有什么想法為什么會改變滾動位置?
它是Kendo Datepicker的錯誤。
我有同樣的問題。 但是我找到了一種解決方法。
滾動發生在DatePickerComponent
中的toggleFocus()
函數上。
要解決此問題,您只需在組件中導入DatePickerComponent
。
import { DatePickerComponent } from "@progress/kendo-angular-dateinputs";
並將此代碼添加到組件的末尾。
(DatePickerComponent as any).prototype.toggleFocus = function() {};
應該是這樣的。
import { Component } from "@angular/core";
import { DatePickerComponent } from "@progress/kendo-angular-dateinputs";
@Component({
selector: "app-your-component",
templateUrl: "./yourComponent.component.html",
})
export class YourComponent {}
(DatePickerComponent as any).prototype.toggleFocus = function() {};
描述的問題是由DatePicker執行的立即彈出內容引起的已知錯誤。 最新(在撰寫本文時)針對Angular的Kendo Popup解決了該問題。 要安裝它,只需運行以下命令:
npm install @progress/kendo-angular-popup@2.2.0
有關該問題的更多詳細信息,請參見相關的Github線程:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.