Git Product home page Git Product logo

sfdx-listview-datatable-example's Introduction

List View Data Table Example

Demonstrates how to use List View Describe information to query for sobject records and display them in a Lightning Component using lightning:datatable.

The UI-API also has ability to retrieve Records and some List View Metadata, but it does not return the data type of each field to know if a field is text, phone, number, etc. which is important when specifying the columns of the <lightning:datatable> component.

Getting Started

  1. Clone this repository
git clone https://github.com/DouglasCAyers/sfdx-listview-datatable-example.git
cd sfdx-listview-datatable-example
  1. Use Salesforce DX CLI to create a scratch org and push the source to it
sfdx force:org:create -f config/project-scratch-def.json -a lvdt -s
sfdx force:source:push -w 10
sfdx force:org:open
  1. Generate a password for the scratch org, you will need your org's username and password in the next step.
sfdx force:user:password:generate
  1. Follow these instructions to create the necessary Connected App, Auth. Provider, and Named Credential to allow Apex used by a Lightning Component to invoke Salesforce REST API.

  2. Create some test records for an object and create a list view for them. Note the list view filter id in the browser's address bar (e.g. 00Bxxxxxxxxxxxx)

  3. Use App Builder to add the custom component ListViewDataTable to a Lightning Page (e.g. a Home Page or Record Page). Specify the Named Credential and List View ID design attributes in App Builder.

    screen shot

Inpsiration

Inspired by Peter Churchill who asked via #askforce on Twitter:

In Classic, I can use getListViewOptions with a Standard Set Controller to display list views in a dropdown, and then get the records for that list using SetFilterId. Is there any equivalent in LEX components, or an alternative that achieves same result?

Disclaimer

This project serves as a quick proof-of-concept and as-such does not provide any unit tests. It is for educational purposes.

sfdx-listview-datatable-example's People

Contributors

douglascayers avatar

Stargazers

Joao Serrano avatar Carlos Carvalho avatar Jeff Held avatar  avatar Jerome Russ avatar Stefan Paulus avatar  avatar

Watchers

James Cloos avatar  avatar

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.