GithubHelp home page GithubHelp logo

tomsouza4 / querygraphqlonlwc Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 1.0 97 KB

Implements pagination using GraphQL queries and Lightning Web Components. Features: Pagination forward and reset page # using GraphQL cursors. Dynamically updating datatable with queried data. Search functionality to filter contacts by name.

Shell 0.91% HTML 17.34% JavaScript 81.75%
graphql lwc lwc-component salesforce-developers salesforce-lightning salesforce-lightning-components

querygraphqlonlwc's Introduction

GraphQL Pagination Example

This repository contains an example implementation of pagination using GraphQL in a Lightning Web Component (LWC) for Salesforce.

It's part of a Tutorial on GraphQL in Salesforce hosted by Panther Schools and Amit Singh

The YouTube series can be found here

Their source code hosted in GitHub can be found here

Components

GraphQLQuery.js

This file contains the JavaScript code for the GraphQLQuery Lightning Web Component. It implements pagination using GraphQL queries and Lightning Web Components.

Features:

  • Pagination forward and reset page # using GraphQL cursors.
  • Dynamically updating datatable with queried data.
  • Search functionality to filter contacts by name.

graphQLQuery.html

This file contains the HTML template for the GraphQLQuery Lightning Web Component. It includes the UI elements like search input, datatable, and pagination buttons.

Features:

  • Lightning Datatable to display queried contacts.
  • Pagination buttons to navigate through pages of contacts.
  • Lightning Spinner to indicate loading state.

How to Use

  1. Clone the repository to your local machine:
git clone https://github.com/tomsouza4/QueryGraphQLOnLWC.git

Output Sample

QueryGraphQLOnLWC.mov

Important Note

In this app theres no pagination backwards and this is due to current limitation on Salesforce GraphQL API. Which is currently in GA as Jan/2024.

Additional Note

Currently the API supports Mutations(Create, Update, Delete) only in Development, it will be available in Production in future releases.

Nice to Haves

Benchmark performance comparing GraphQL to other formats of queries.

  • Query data using native LWC to get Records such as '@salesforce/schema/Contact'.
  • Custom Apex Class to query data from Salesforce.

querygraphqlonlwc's People

Contributors

tomsouza4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lsit99991

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.