sort columns in ascending and descending order in lwc -- w3web.net

lwc datatable with sorting of columns ascending and descending order of account object’s fields Uses of ‘lightning-datatable’ elements in Salesforce — LWC | How to sorting of columns ascending and descending order in lwc

754 views

Hey guys, today in this post we are going to learn about How to sorting of columns ascending and descending order of account object’s fields Uses of ‘lightning-datatable’ elements in Salesforce Lightning Web Component — LWC.

Here I am creating lwc datatable with sorting the columns of Account Object by ascending and descending order in lightning web component (LWC).

Files we used in this post example

lwcSortingDataTable.html LWc HTML File Template HTML file to create datatable with sorting of columns by Ascending & Descending Order in lwc
lwcSortingDataTable.js LWC JavaScript File It’s hold a javascript on click function to sorting the column of Account Object by Ascending & Descending Order.
lwcSortingDataTable.js-meta.xml XML Meta File It is used to where this lightning web component file you want to display as like lightning__AppPage, lightning__RecordPage, lightning__HomePage.
lwcSortingDataTableCtrl.cls Apex Class Controller It is used for fetching the data of Account from server.

Final Output

sort columns in ascending and descending order in lwc -- w3web.net

Other related post that would you like to learn in Salesforce

  • Find the below steps

Create Lightning Web Component HTML

Step 1:- Create Lightning Web Component HTML ➡ lwcSortingDataTable.html

SFDX:Lightning Web Component ➡ New ➡ lwcSortingDataTable.html

lwcSortingDataTable.html [Lightning Web Component HTML]

Create Lightning Web Component Javascript

Step 2:- Create Lightning Web Component Javascript ➡ lwcSortingDataTable.js

SFDX:Lightning Web Component ➡ New ➡ lwcSortingDataTable.js

lwcSortingDataTable.js [LWC JavaScript File]

Create Lightning Web Component Meta XML

Step 3:- Create Lightning Web Component Meta XML ➡ lwcSortingDataTable.js-meta.xml

SFDX:Lightning Web Component ➡ New >> lwcSortingDataTable.js-meta.xml

lwcSortingDataTable.js-meta.xml [LWC Meta Data XML]

Create Apex Class Controller

Step 4:- Create Apex Controller ➡ lwcSortingDataTableCtrl.cls

SFDX:Create Apex Class ➡ New ➡ lwcSortingDataTableCtrl.cls

lwcSortingDataTableCtrl.cls [Apex Class]

sort columns in ascending and descending order in lwc -- w3web.net

Further post that would you like to learn in Salesforce

 

 

FAQ (Frequently Asked Questions)

How do I sort multiple columns in DataTable?

DataTables allows ordering by multiple columns at the same time, which can be activated in a number of different ways:User shift click on a column.

How do I sort a column in DataTable?

Using the order initialisation parameter, you can set the table to display the data in exactly the order that you want.

What is default view in DataTable?

The DefaultView property returns a DataView you can use to sort, filter, and search a DataTable.

Related Topics | You May Also Like

  • Your reaction of the article ▾
 

Hi, This is Vijay Kumar behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | | The Sitemap where you can find all published post on w3web.net

5 thoughts on “lwc datatable with sorting of columns ascending and descending order of account object’s fields Uses of ‘lightning-datatable’ elements in Salesforce — LWC | How to sorting of columns ascending and descending order in lwc”

Leave a Comment