Pagination Alfresco ADF使用dataTable组件自定义分页

Pagination Alfresco ADF使用dataTable组件自定义分页,pagination,alfresco,Pagination,Alfresco,我需要为dataTable组件进行分页。我发现了这个,但我不知道如何实现它。是否有任何实现示例 我有一个ObjectDataTableAdapter,在其中我将JSON数据从Alfresco webscript拉到datatable组件 HTML文件 <adf-toolbar title="Toolbar"> <button mat-icon-button (click)="bulkAction()"> &

我需要为dataTable组件进行分页。我发现了这个,但我不知道如何实现它。是否有任何实现示例

我有一个ObjectDataTableAdapter,在其中我将JSON数据从Alfresco webscript拉到datatable组件

HTML文件

<adf-toolbar title="Toolbar">
    <button mat-icon-button (click)="bulkAction()">
        <mat-icon>repeat</mat-icon>
    </button>
</adf-toolbar>
<adf-datatable
    [data]="data"
    [multiselect]="true"
    [actions]="true"
    (showRowActionsMenu)="onShowRowActionsMenu($event)"
    (executeRowAction)="onExecuteRowAction($event)">
    <adf-no-content-template>
        <ng-template>
            <h1>Kde nic, tu nic.</h1>
        </ng-template>
    </adf-no-content-template>
</adf-datatable>

<!-- <adf-pagination 
    [target]="data"
    [pagination]="5"
    [supportedPageSizes]="[5, 10, 15, 20]">
</adf-pagination> -->
import { Component, OnInit } from '@angular/core';
import { ObjectDataTableAdapter } from '@alfresco/adf-core';
import { DataCellEvent, DataRowActionEvent } from '@alfresco/adf-core';
import { AlfrescoApiService } from "@alfresco/adf-core";

@Component({

  selector: 'aca-my-first-view',
  templateUrl: './my-first-view.component.html',
  styleUrls: ['./my-first-view.component.scss']
})
export class MyFirstViewComponent implements OnInit {
  scriptPath: string = 'sample/folder/Company%20Home';
  ecmHost: string;
  data: ObjectDataTableAdapter;

  isLoading = false;
  constructor(
    private alfrescoApi: AlfrescoApiService
  ) {


    this.data = new ObjectDataTableAdapter(
      // data
      [],
      // columns
      []
    );

  }


  ngOnInit(): void {
    console.log("tady");
    //console.log(this.getJSONByFTS());
    this.getJSONByFTS().then(result => {
      var string = result as string;

      let jsonArray = string.slice(1, -1).split(", ");
      console.log("jsonArray: " + jsonArray);
      let finalData = Array<any>();
      jsonArray.forEach(element => {
        console.log("element: " + element)
        let json = JSON.parse(element);

        console.log("json: " + json)


        finalData.push(json);
      });

      console.log("finalData: " + finalData);
      //Data
      this.data = new ObjectDataTableAdapter(finalData,

        // columns
        [
          {
            type: 'text',
            key: 'nodeRef',
            title: 'Id',
            sortable: true
          },
          {
            type: 'text',
            key: 'name',
            title: 'Name',
            cssClass: 'full-width',
            sortable: true
          }
        ]);
    }).catch(error => {
      console.log(error);
    })

  }

  public getJSONByFTS(): Promise<any> {
    return this.alfrescoApi.getInstance().webScript.executeWebScript('GET', 'jsonByFTS');
  }

  bulkAction() {

    for (let row of this.data.getRows()) {

      if (row.isSelected == true) {
        console.log(row.getValue("nodeRef"));
      }

    }

  }

  onShowRowActionsMenu(event: DataCellEvent) {
    let myAction = {
      title: 'Zobraz nodeRef'
      // your custom metadata needed for onExecuteRowAction
    };
    event.value.actions = [
      myAction
    ];
  }

  onExecuteRowAction(event: DataRowActionEvent) {
    let args = event.value;
    let jeZaskrtle = args.row.isSelected;
    alert("jeZaskrtle: " + jeZaskrtle);
    console.log(args.row);
    console.log(args.action);
    window.alert(`NodeRef: ${args.row.getValue("nodeRef")}`);
    //získání NodeRefu z akce na řádku
    console.log(args.row.getValue("nodeRef"));
  }

  logDataExample(event) {
    console.log('Your webscript data is here' + event);
  }


}

重复
Kde网卡,tu网卡。
TS文件

<adf-toolbar title="Toolbar">
    <button mat-icon-button (click)="bulkAction()">
        <mat-icon>repeat</mat-icon>
    </button>
</adf-toolbar>
<adf-datatable
    [data]="data"
    [multiselect]="true"
    [actions]="true"
    (showRowActionsMenu)="onShowRowActionsMenu($event)"
    (executeRowAction)="onExecuteRowAction($event)">
    <adf-no-content-template>
        <ng-template>
            <h1>Kde nic, tu nic.</h1>
        </ng-template>
    </adf-no-content-template>
</adf-datatable>

<!-- <adf-pagination 
    [target]="data"
    [pagination]="5"
    [supportedPageSizes]="[5, 10, 15, 20]">
</adf-pagination> -->
import { Component, OnInit } from '@angular/core';
import { ObjectDataTableAdapter } from '@alfresco/adf-core';
import { DataCellEvent, DataRowActionEvent } from '@alfresco/adf-core';
import { AlfrescoApiService } from "@alfresco/adf-core";

@Component({

  selector: 'aca-my-first-view',
  templateUrl: './my-first-view.component.html',
  styleUrls: ['./my-first-view.component.scss']
})
export class MyFirstViewComponent implements OnInit {
  scriptPath: string = 'sample/folder/Company%20Home';
  ecmHost: string;
  data: ObjectDataTableAdapter;

  isLoading = false;
  constructor(
    private alfrescoApi: AlfrescoApiService
  ) {


    this.data = new ObjectDataTableAdapter(
      // data
      [],
      // columns
      []
    );

  }


  ngOnInit(): void {
    console.log("tady");
    //console.log(this.getJSONByFTS());
    this.getJSONByFTS().then(result => {
      var string = result as string;

      let jsonArray = string.slice(1, -1).split(", ");
      console.log("jsonArray: " + jsonArray);
      let finalData = Array<any>();
      jsonArray.forEach(element => {
        console.log("element: " + element)
        let json = JSON.parse(element);

        console.log("json: " + json)


        finalData.push(json);
      });

      console.log("finalData: " + finalData);
      //Data
      this.data = new ObjectDataTableAdapter(finalData,

        // columns
        [
          {
            type: 'text',
            key: 'nodeRef',
            title: 'Id',
            sortable: true
          },
          {
            type: 'text',
            key: 'name',
            title: 'Name',
            cssClass: 'full-width',
            sortable: true
          }
        ]);
    }).catch(error => {
      console.log(error);
    })

  }

  public getJSONByFTS(): Promise<any> {
    return this.alfrescoApi.getInstance().webScript.executeWebScript('GET', 'jsonByFTS');
  }

  bulkAction() {

    for (let row of this.data.getRows()) {

      if (row.isSelected == true) {
        console.log(row.getValue("nodeRef"));
      }

    }

  }

  onShowRowActionsMenu(event: DataCellEvent) {
    let myAction = {
      title: 'Zobraz nodeRef'
      // your custom metadata needed for onExecuteRowAction
    };
    event.value.actions = [
      myAction
    ];
  }

  onExecuteRowAction(event: DataRowActionEvent) {
    let args = event.value;
    let jeZaskrtle = args.row.isSelected;
    alert("jeZaskrtle: " + jeZaskrtle);
    console.log(args.row);
    console.log(args.action);
    window.alert(`NodeRef: ${args.row.getValue("nodeRef")}`);
    //získání NodeRefu z akce na řádku
    console.log(args.row.getValue("nodeRef"));
  }

  logDataExample(event) {
    console.log('Your webscript data is here' + event);
  }


}
从'@angular/core'导入{Component,OnInit};
从'@alfresco/adf core'导入{ObjectDataTableAdapter};
从'@alfresco/adf core'导入{DataCellEvent,DataRowActionEvent};
从“@alfresco/adf core”导入{AlfrescoApiService}”;
@组成部分({
选择器:“aca我的第一个视图”,
templateUrl:'./my first view.component.html',
样式URL:['./我的第一个视图.component.scss']
})
导出类MyFirstViewComponent实现OnInit{
脚本路径:字符串='sample/folder/Company%20Home';
ecmHost:string;
数据:ObjectDataTableAdapter;
isLoading=false;
建造师(
私人露天服务
) {
this.data=新的ObjectDataTableAdapter(
//资料
[],
//纵队
[]
);
}
ngOnInit():void{
控制台日志(“tady”);
//log(this.getJSONByFTS());
this.getJSONByFTS().then(结果=>{
var string=结果为字符串;
让jsonArray=string.slice(1,-1.split(“,”);
log(“jsonArray:+jsonArray”);
设finalData=Array();
forEach(元素=>{
日志(“元素:”+元素)
让json=json.parse(元素);
log(“json:+json”)
push(json);
});
console.log(“finalData:+finalData”);
//资料
this.data=新的ObjectDataTableAdapter(finalData,
//纵队
[
{
键入:“文本”,
键:“nodeRef”,
标题:“Id”,
可排序:正确
},
{
键入:“文本”,
关键字:“名称”,
标题:“姓名”,
cssClass:“全宽”,
可排序:正确
}
]);
}).catch(错误=>{
console.log(错误);
})
}
public getJSONByFTS():Promise{
返回这个.alfrescoApi.getInstance().webScript.executeWebScript('GET','jsonByFTS');
}
行动(){
for(让此.data.getRows()的第行){
if(row.isSelected==true){
log(row.getValue(“nodeRef”);
}
}
}
onShowRowActionsMenu(事件:DataCellEvent){
让我的动作={
标题:“佐布拉兹·诺德雷夫”
//OneXecuteRowaAction所需的自定义元数据
};
event.value.actions=[
我的行动
];
}
OneXecuteRowaAction(事件:DataRowActionEvent){
设args=event.value;
让jeZaskrtle=args.row.isSelected;
警报(“jeZaskrtle:+jeZaskrtle”);
console.log(args.row);
console.log(args.action);
alert(`NodeRef:${args.row.getValue(“NodeRef”)}`);
//茨卡尼·诺德雷夫·阿克斯·纳瓦德库
log(args.row.getValue(“nodeRef”);
}
logDataExample(事件){
log('您的webscript数据在此'+事件);
}
}