我有一个像这样的聚合组件:
private gridOptions = {
columnDefs: this.columnDefs,
frameworkComponents: { buttonRenderer: ButtonRenderer},
pagination: true,
paginationPageSize: 20,
cacheBlockSize: 20,
// server side paging
rowModelType: 'infinite',
datasource: this.dataSource
};
private dataSource: IDatasource = {
getRows: (params: IGetRowsParams) => {
var query = { startrow: params.startRow,
endrow: params.endRow,
company_name: this.companyName,
company_address: this.companyAddress,
company_capital: this.companyCapital
};
this.http.post(environment.api_url + "/register/search",query).subscribe((results:any) => {
params.successCallback(results.data, results.totalRecords);
this.gridApi.refresh();
});
}
};
Run Code Online (Sandbox Code Playgroud)
aggrid首次加载时,显示正常。如果我按下一页,我收到此错误:
ERROR Error: "ag-Grid: cannot get grid to draw rows when it is in the middle
of drawing …
Run Code Online (Sandbox Code Playgroud) 我尝试在 angular7 中使用 ag-grid,我的代码如下所示:
从 '@angular/core' 导入 { Component, OnInit }; 从 '@angular/common/http' 导入 { HttpClient, HttpHeaders }; 从“ag-grid-angular”导入{AgGridModule}; @成分({ 选择器:'app-top100sp', templateUrl: './top100sp.component.html', styleUrls: ['./top100sp.component.css'] }) 导出类 Top100spComponent 实现 OnInit { 私有top100url = 'http://resturl'; 私有网格选项; 私有每页行= 20; 专用端点; 私有行数据; 私有休息数据源; 私有columnDefs = [ 。 。 。 ]; 构造函数(私有http:HttpClient){} ngOnInit() { this.gridOptions = { columnDefs: this.columnDefs, rowModelType: '无限', //数据源:this.restDatasource, 启用服务器端过滤器:假, 启用服务器端排序:假, 分页:真实, 分页页面大小:this.row_per_page }; } 网格就绪($事件){ console.log("onGridReady "+$event.api.paginationGetPageSize()); this.restDatasource = { 行数:空, getRows:函数(参数){ console.log(params.startRow + " 到 " + params.endRow); this.endpoint …
我将一个 Angular 应用程序部署到 apache 服务器。Android应用程序只创建一个webview并添加JavascriptSupport,如下所示
webView=this.findViewById(R.id.webview);
webView.addJavascriptInterface(new JavascriptSupport(this), "jsinterface");
Run Code Online (Sandbox Code Playgroud)
Android应用程序有一个toast方法,如下所示:
@JavascriptInterface
public void toast(String message) {
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}
Run Code Online (Sandbox Code Playgroud)
我尝试从 Angular 8 应用程序调用 toast 方法,但没有成功。像这样的角度代码
export interface JavascriptInterface {
toast(message: string): void;
}
Run Code Online (Sandbox Code Playgroud)
在另一个类中我调用这个接口方法
public jsinterface: JavascriptInterface;
showtoast() {
this.jsinterface.toast("Hello");
}
Run Code Online (Sandbox Code Playgroud)
但我在模拟器控制台中遇到这样的错误
I/chromium: [INFO:CONSOLE(1)] "ERROR", source: http://<angular app url>/main-es2015.3bb15247496d83d1869d.js (1)
Run Code Online (Sandbox Code Playgroud)
如何正确调用android方法。
谢谢,
I am using angular 7
Angular CLI: 7.3.9 Node: 10.16.3 OS: linux x64 Angular: 7.2.15
I use this code to pass data when route to another component
this.router.navigate(['/product'],{state: {token: data.token}});
and try to get token using following code
ngOnInit() {
console.log("#25");
this.state = this.activatedRoute.paramMap
.pipe(map(() => window.history.state));
console.log("#28"); //method 1
console.log(this.state.token);
this.router.events.pipe(filter(e => e instanceof NavigationStart))
.subscribe((e: NavigationStart) => {
this.state = this.router.getCurrentNavigation().extras.state;
console.log("#33"); //method 2
console.log(this.state.token);
});
}
Run Code Online (Sandbox Code Playgroud)
the console show
undefined
both method cannot …