当我尝试在基本 HTML 页面上呈现链接时,我尝试呈现的链接如下所示:
<a [routerLink]="['/leverance/detail', 13]">A new link</a>
Run Code Online (Sandbox Code Playgroud)
当尝试在 ag-Grid 上呈现它时,我尝试执行以下操作:
src\app\leverancer\leverancer.component.ts
ngOnInit() {
this.dataGridColumnDefs = [
{
headerName: 'Type',
field: 'leveranceType.name',
width: 150,
cellRenderer: this.customCellRendererFunc
}
];
}
customCellRendererFunc(params): string {
const cellContent `<a [routerLink]="['/leverance/detail', 13]">A new link</a>`;
return cellContent;
}
Run Code Online (Sandbox Code Playgroud)
但我在我的 ag-Grid 中没有看到有效的 routerLink。你能告诉我我需要做什么才能在我的 ag-Grid 中渲染一个工作的 routerLink 吗?
我们的 SQL Server 数据库表中有一个由 SQL Server 自动生成的字段,该字段称为CreatedTime.
我们已将整个数据库表映射到实体框架中的数据模型,因此也将字段CreatedTime.
当我们通过实体框架在数据库中插入新行时,我们不会为 提供任何值CreatedTime。
这会导致插入失败并显示错误:
SqlDateTime 溢出。必须在 1/1/1753 12:00:00 AM 和 12/31/9999 11:59:59 PM 之间
所以问题是:有没有办法在实体框架插入语句中排除实体数据模型中的特定字段?这样我们就不会得到上面的错误?
我们希望将字段保留CreatedTime在实体模型中,因为我们可能想稍后访问它。
当我自动生成 dart 构造函数时,我希望生成器使用命名参数来创建我的构造函数并添加键。
(大括号包裹构造函数参数)
我可以执行一些简单的技巧让 Android Studio 为我执行此操作吗?
// Auto generated constructor without named parameters.
// This is how Android studio currently generates my Widget constructors.
class MyTestModel {
MyTestModel(this.a, this.b, this.c);
final String a;
final String b;
final String c;
}
// Constructor with named parameters and key.
// This is how I would like Android Studio Auto Generate to behave.
class MyTestModelB {
MyTestModelB({Key key, this.a, this.b, this.c}) : super(key: key);
final String a;
final String b;
final …Run Code Online (Sandbox Code Playgroud) 我有一个包含两列的 ag-Grid:ID 列和描述列。我在 TypeScript 类的 ngOnInit() 方法的 columnDefs 中构造了这两列的列定义。
在“描述”列中,我使用 cellRendererFramework 在我的 ag-Grid 中渲染 routerLink。我使用 cellRendererParams 将一些必要的参数传递到我的 Angular 渲染器组件。正是在“描述”列中,我需要访问 ID 列的 ID 值,并将其放入 cellRendererParams 参数“resourceId”中。我需要这个 ID 才能构建我的工作 RouterLink。
我怎样才能在下面的代码中做到这一点?
ngOnInit() {
this.columnDefs = [
// Column A - ID
{
headerName: 'ID',
field: 'id',
width: 80,
sort: 'desc'
},
// Column B - Description
{
headerName: 'Description',
field: 'description',
width: 150,
cellRendererFramework: AgGridRouterLinkRendererComponent,
cellRendererParams: {
resourcePath: '/leverance/detail',
resourceId: HERE-I-WOULD-LIKE-TO-ACCESS-THE-ID-VALUE-OF-THE-ID-FIELD-IN-THE-ID-COLUMN-ABOVE
}
];
}
Run Code Online (Sandbox Code Playgroud) 我正在声明如下列表,然后我添加了12个项目:
List lstPolygonWkt = new List();
foreach(var i in items)lstPolygonWkt.Add(i.PolygonWkt);
人们应该认为该列表现在包含12个元素,对吧?但令我惊讶的是,该列表突然包含16个项目,然后最后4个项目为空.我不明白为什么我的列表应该是12项突然16项.知道为什么吗?以及如何使列表只应该是12个项目?
我将粘贴几个屏幕截图:

