我是ng2-smart-tables的新手.我正在尝试从GitHub页面修改下面的示例,以便在从一个页面移动到另一个页面时复选框不会消失.
import { Component } from '@angular/core';
@Component({
selector: 'basic-example-multi-select',
template: `
<ng2-smart-table [settings]="settings" [source]="data"></ng2-smart-table>
`,
})
export class BasicExampleMultiSelectComponent {
settings = {
selectMode: 'multi',
columns: {
id: {
title: 'ID',
},
name: {
title: 'Full Name',
},
username: {
title: 'User Name',
},
email: {
title: 'Email',
},
},
};
data = [
{
id: 1,
name: 'Leanne Graham',
username: 'Bret',
email: 'Sincere@april.biz',
},
{
id: 2,
name: 'Ervin Howell',
username: 'Antonette',
email: 'Shanna@melissa.tv',
},
{
id: 3, …Run Code Online (Sandbox Code Playgroud) 我正在使用 Ng2SmartTable 并且出现此错误:
目标入口点“ng2-smart-table”中的错误缺少依赖项:-@akveo / ng2-completer
我已经尝试了以下命令,但它不起作用:
1.npm install --save ng2-smart-table
2.npm ng2-completer --save
3.npm i rxjs-compat --save
我正在使用启用了Pager的后端服务器(Java Spring).我在HTTP调用上每页加载100条记录.
在angular2服务上,它使用"?page = 1&size = 100"作为初始调用的API调用,而在客户端大小的寻呼机上,它显示10并且最多移动10页,这很好.但我无法从服务器加载下一块数据.我检查了ServerDataSource并使用了.setPaging(1,100).
如何加载下一个数据块(2-200)以及如何实现此目的.任何提示都会有所帮助.
@Injectable()
export class AmazonService extends ServerDataSource {
constructor(protected http: Http) {
super(http);
}
public getAmazonInformation(page, size): Observable<Amazon[]> {
let url = 'http://localhost:8080/plg-amazon?page=1&size=100';
this.setPaging(1, 100, true);
if (this.pagingConf && this.pagingConf['page'] &&
this.pagingConf['perPage']) {
url +=
`page=${this.pagingConf['page']}&size=${this.pagingConf['perPage']}`;
}
return this.http.get(url).map(this.extractData).catch(this.handleError);
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
ng2-smart-table的开发已经停滞不前,我正在尝试为存储库构建一个fork,但它似乎没有构建.
我以前做过类似的事情,通常只是创建一个存储库的分支.放入我的更改,然后在我的主项目上修改package.json以指向github项目
但是,当我尝试为ng2-smart-table执行此操作时,我收到错误:无法安装git + https://github.com/atlantageek/ng2-smart-table.git#8f37d374a87a9008328aaea36ad6ce78a28ce7a8:缺少包版本
我也无法破译构建发布过程,开发人员对这些问题一无所知.有没有人有任何指导.
我正在尝试使用该组件<ng2-smart-table>。我确实做到了,但是我需要在用户单击页面或列进行排序后刷新数据,有什么方法可以捕获这些事件并刷新数据?
table.component.html
<ng2-smart-table
[settings]="settings"
[source]="characters">
</ng2-smart-table>
Run Code Online (Sandbox Code Playgroud)
表.service.ts
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
@Injectable()
export class TableService {
constructor(private http: HttpClient) { }
url = 'http://localhost:4000';
getCharacters() {
return this
.http
.get(`${this.url}/characters`);
}
}
Run Code Online (Sandbox Code Playgroud)
表.interface.ts
export interface Table {
ticket: String;
title: String;
state: String;
owner: String;
age: String;
priority: String;
}
Run Code Online (Sandbox Code Playgroud)
table.component.ts
import { Component, OnInit } from '@angular/core';
import { TableService } from './table.service';
import { Table } from './table.interface'; …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我在ng2-smart-table的下拉列表中加载了动态值.现在我必须在ng2-smart-table中的下拉列表中启用多个选择.
注意:下拉列表中的多项选择不是复选框.
在ng2-smart-table中,角度 2排序功能区分大小写.是否有任何选项可以使排序表数据不区分大小写?
以上是我在 Firebase 的 Firestore 数据库中的数据结构。我可以使用以下设置成功提取数据并将其放入 ng2 智能表中:
export const userTableSettings = {
delete: {
confirmDelete: true,
deleteButtonContent: '<i class="ft-x danger font-medium-1 mr-2"></i>'
},
add: {
confirmCreate: true,
},
edit: {
confirmSave: true,
editButtonContent: '<i class="ft-edit-2 info font-medium-1 mr-2"></i>'
},
firstName: {
title: 'Full Name',
},
lastName: {
title: 'User Name',
},
email: {
title: 'Email',
},
},
attr: {
class: 'table table-responsive'
},
};
Run Code Online (Sandbox Code Playgroud)
但是当我为角色添加位置时
roles: {
title: 'Role',
},
Run Code Online (Sandbox Code Playgroud)
输出是
我希望能够显示一个或多个用户角色(如果他们有多个角色),并且能够从表中更新它们。
firebase typescript ng2-smart-table google-cloud-firestore angular5
我有一个由 ng2-smart-table 构建的表,表中的数据有两种状态Draft和Ready。当 时data.status = 'Draft',可以出于 CRUD 目的显示操作列,但随后状态更改为data.status = 'Ready',我想禁用操作列。如何有条件地做到这一点?
桌面设置:
tableSettings = {
add: {
addButtonContent: '<i class="fas fa-plus fa-fw"></i>',
createButtonContent: '<i class="fas fa-plus fa-fw"></i>',
cancelButtonContent: '<i class="fas fa-times fa-fw"></i>',
confirmCreate: true
},
edit: {
editButtonContent: '<i class="fas fa-pencil-alt fa-fw"></i>',
saveButtonContent: '<i class="fas fa-check fa-fw"></i>',
cancelButtonContent: '<i class="fas fa-times fa-fw"></i>',
confirmSave: true
},
delete: {
deleteButtonContent: '<i class="far fa-trash-alt fa-fw"></i>',
confirmDelete: true
},
columns: {
title: {
title: 'Title',
type: 'text', …Run Code Online (Sandbox Code Playgroud) 我用于在应用程序ng2-smart-table中显示数据angular 6。我启用了过滤功能。现在我想将search所有占位符中的默认设置为文本columns。我已经搜索了很多。但我无法更改过滤器的占位符。
<ng2-smart-table [settings]="setting" [source]="dataSource"></ng2-smart-table>
Run Code Online (Sandbox Code Playgroud)
在 .ts 文件中。
add: {
confirmCreate: false
},
columns: {
id: {
title: 'ID',
filter: true
},
name: {
title: 'First Name',
filter: true
},
}
Run Code Online (Sandbox Code Playgroud) ng2-smart-table ×10
angular ×8
angular6 ×2
typescript ×2
angular5 ×1
checkboxlist ×1
firebase ×1
javascript ×1
pagination ×1
placeholder ×1
web ×1