<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ADF custom pagination with dataTable component in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/adf-custom-pagination-with-datatable-component/m-p/9270#M4138</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need make pagination for dataTable component. I found this &lt;A href="https://www.alfresco.com/abn/adf/docs/core/components/pagination.component/#custom-pagination" target="_blank" rel="noopener nofollow noreferrer"&gt;Custom pagination&lt;/A&gt;&amp;nbsp;documentation, but I dont undestand how to implement it. Is there any implementation example?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a &lt;SPAN&gt;ObjectDataTableAdapter &amp;nbsp;in which I pull JSON data from my Alfresco webscript to datatable component.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Snímek obrazovky 2021-06-01 v&amp;nbsp;18.16.35.png" style="width: 400px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/114iFC93E4D097528877/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTML file&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;adf-toolbar title="Toolbar"&amp;gt;
    &amp;lt;button mat-icon-button (click)="bulkAction()"&amp;gt;
        &amp;lt;mat-icon&amp;gt;repeat&amp;lt;/mat-icon&amp;gt;
    &amp;lt;/button&amp;gt;
&amp;lt;/adf-toolbar&amp;gt;
&amp;lt;adf-datatable
    [data]="data"
    [multiselect]="true"
    [actions]="true"
    (showRowActionsMenu)="onShowRowActionsMenu($event)"
    (executeRowAction)="onExecuteRowAction($event)"&amp;gt;
    &amp;lt;adf-no-content-template&amp;gt;
        &amp;lt;ng-template&amp;gt;
            &amp;lt;h1&amp;gt;Kde nic, tu nic.&amp;lt;/h1&amp;gt;
        &amp;lt;/ng-template&amp;gt;
    &amp;lt;/adf-no-content-template&amp;gt;
&amp;lt;/adf-datatable&amp;gt;

&amp;lt;!-- &amp;lt;adf-pagination 
    [target]="data"
    [pagination]="5"
    [supportedPageSizes]="[5, 10, 15, 20]"&amp;gt;
&amp;lt;/adf-pagination&amp;gt; --&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;TS file&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;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 =&amp;gt; {
      var string = result as string;

      let jsonArray = string.slice(1, -1).split(", ");
      console.log("jsonArray: " + jsonArray);
      let finalData = Array&amp;lt;any&amp;gt;();
      jsonArray.forEach(element =&amp;gt; {
        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 =&amp;gt; {
      console.log(error);
    })

  }

  public getJSONByFTS(): Promise&amp;lt;any&amp;gt; {
    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);
  }


}&lt;/PRE&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 15 May 2021 16:16:16 GMT</pubDate>
    <dc:creator>wity</dc:creator>
    <dc:date>2021-05-15T16:16:16Z</dc:date>
    <item>
      <title>ADF custom pagination with dataTable component</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/adf-custom-pagination-with-datatable-component/m-p/9270#M4138</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need make pagination for dataTable component. I found this &lt;A href="https://www.alfresco.com/abn/adf/docs/core/components/pagination.component/#custom-pagination" target="_blank" rel="noopener nofollow noreferrer"&gt;Custom pagination&lt;/A&gt;&amp;nbsp;documentation, but I dont undestand how to implement it. Is there any implementation example?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a &lt;SPAN&gt;ObjectDataTableAdapter &amp;nbsp;in which I pull JSON data from my Alfresco webscript to datatable component.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Snímek obrazovky 2021-06-01 v&amp;nbsp;18.16.35.png" style="width: 400px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/114iFC93E4D097528877/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;HTML file&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;adf-toolbar title="Toolbar"&amp;gt;
    &amp;lt;button mat-icon-button (click)="bulkAction()"&amp;gt;
        &amp;lt;mat-icon&amp;gt;repeat&amp;lt;/mat-icon&amp;gt;
    &amp;lt;/button&amp;gt;
&amp;lt;/adf-toolbar&amp;gt;
&amp;lt;adf-datatable
    [data]="data"
    [multiselect]="true"
    [actions]="true"
    (showRowActionsMenu)="onShowRowActionsMenu($event)"
    (executeRowAction)="onExecuteRowAction($event)"&amp;gt;
    &amp;lt;adf-no-content-template&amp;gt;
        &amp;lt;ng-template&amp;gt;
            &amp;lt;h1&amp;gt;Kde nic, tu nic.&amp;lt;/h1&amp;gt;
        &amp;lt;/ng-template&amp;gt;
    &amp;lt;/adf-no-content-template&amp;gt;
&amp;lt;/adf-datatable&amp;gt;

&amp;lt;!-- &amp;lt;adf-pagination 
    [target]="data"
    [pagination]="5"
    [supportedPageSizes]="[5, 10, 15, 20]"&amp;gt;
&amp;lt;/adf-pagination&amp;gt; --&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;TS file&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;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 =&amp;gt; {
      var string = result as string;

      let jsonArray = string.slice(1, -1).split(", ");
      console.log("jsonArray: " + jsonArray);
      let finalData = Array&amp;lt;any&amp;gt;();
      jsonArray.forEach(element =&amp;gt; {
        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 =&amp;gt; {
      console.log(error);
    })

  }

  public getJSONByFTS(): Promise&amp;lt;any&amp;gt; {
    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);
  }


}&lt;/PRE&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 May 2021 16:16:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/adf-custom-pagination-with-datatable-component/m-p/9270#M4138</guid>
      <dc:creator>wity</dc:creator>
      <dc:date>2021-05-15T16:16:16Z</dc:date>
    </item>
  </channel>
</rss>

