From 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 14:56:14 +0800
Subject: [PATCH] lex community

---
 force-app/main/default/lwc/paginatedList/paginatedList.js |   52 +++++++++++++++++++++++++++++-----------------------
 1 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/force-app/main/default/lwc/paginatedList/paginatedList.js b/force-app/main/default/lwc/paginatedList/paginatedList.js
index b016d13..243ca83 100644
--- a/force-app/main/default/lwc/paginatedList/paginatedList.js
+++ b/force-app/main/default/lwc/paginatedList/paginatedList.js
@@ -1,36 +1,36 @@
-import { LightningElement, api, track } from "lwc";
-import getAccountsPaginated from "@salesforce/apex/PaginatedListControllerLwc.getAccountsPaginated";
+import { LightningElement, api, track } from 'lwc';
+import getAccountsPaginated from '@salesforce/apex/PaginatedListControllerLwc.getAccountsPaginated';
 import { ShowToastEvent } from 'lightning/platformShowToastEvent';
 import { reduceErrors } from 'c/ldsUtils';
-import ACCOUNT_NAME_FIELD from "@salesforce/schema/Account.Name";
-import ACCOUNT_TYPE_FIELD from "@salesforce/schema/Account.Type";
-import ACCOUNT_PHONE_FIELD from "@salesforce/schema/Account.Type";
-import ACCOUNT_EMPLOYEES_FIELD from "@salesforce/schema/Account.NumberOfEmployees";
+import ACCOUNT_NAME_FIELD from '@salesforce/schema/Account.Name';
+import ACCOUNT_TYPE_FIELD from '@salesforce/schema/Account.Type';
+import ACCOUNT_PHONE_FIELD from '@salesforce/schema/Account.Type';
+import ACCOUNT_EMPLOYEES_FIELD from '@salesforce/schema/Account.NumberOfEmployees';
 
 const COLUMNS = [
     {
-        label: "Account Name",
+        label: 'Account Name',
         fieldName: ACCOUNT_NAME_FIELD.fieldApiName,
-        type: "text",
-        sortable: "true"
+        type: 'text',
+        sortable: 'true'
     },
-    { label: "Type", fieldName: ACCOUNT_TYPE_FIELD.fieldApiName, type: "text" },
+    { label: 'Type', fieldName: ACCOUNT_TYPE_FIELD.fieldApiName, type: 'text' },
     {
-        label: "Phone",
+        label: 'Phone',
         fieldName: ACCOUNT_PHONE_FIELD.fieldApiName,
-        type: "phone"
+        type: 'phone'
     },
     {
-        label: "Employees",
+        label: 'Employees',
         fieldName: ACCOUNT_EMPLOYEES_FIELD.fieldApiName,
-        type: "Number"
+        type: 'Number'
     }
 ];
 
 export default class PaginatedList extends LightningElement {
     columns = COLUMNS;
-    @track sortBy = "Name";
-    @track sortDirection = "asc";
+    @track sortBy = 'Name';
+    @track sortDirection = 'asc';
     @track pageSize = 10;
     error;
     records;
@@ -61,8 +61,11 @@
                     this.totalRecords = result.totalRecords;
                     this.recordStart = result.recordStart;
                     this.recordEnd = result.recordEnd;
-                    this.totalPages = Math.ceil(result.totalRecords / this.pageSize);
-                    this.paginationVisibility = this.totalPages > 1 ? true : false;
+                    this.totalPages = Math.ceil(
+                        result.totalRecords / this.pageSize
+                    );
+                    this.paginationVisibility =
+                        this.totalPages > 1 ? true : false;
                 }
             })
             .catch((error) => {
@@ -78,7 +81,7 @@
             });
     }
     doSorting(event) {
-        console.log("Sort");
+        console.log('Sort');
         this.sortBy = event.detail.fieldName;
         this.sortDirection = event.detail.sortDirection;
         this.currentPageToken = 0;
@@ -86,12 +89,14 @@
     }
 
     handlePrevious() {
-        this.currentPageToken = Number(this.currentPageToken) - Number(this.pageSize);
+        this.currentPageToken =
+            Number(this.currentPageToken) - Number(this.pageSize);
         this.getAccounts();
     }
 
     handleNext() {
-        this.currentPageToken = Number(this.currentPageToken) + Number(this.pageSize);
+        this.currentPageToken =
+            Number(this.currentPageToken) + Number(this.pageSize);
         this.getAccounts();
     }
     handleFirst() {
@@ -100,7 +105,8 @@
     }
 
     handleLast() {
-        this.currentPageToken = this.totalPages > 1? (this.totalPages-1)* this.pageSize:0;
+        this.currentPageToken =
+            this.totalPages > 1 ? (this.totalPages - 1) * this.pageSize : 0;
         this.getAccounts();
     }
 
@@ -117,4 +123,4 @@
     get nextButtonDisabled() {
         return this.nextPageToken === undefined;
     }
-}
\ No newline at end of file
+}

--
Gitblit v1.9.1