// set the arrowDirection attribute for conditionally rendred arrow sign

component.set("v.arrowDirection",'arrowup');

// set the isAsc flag to true for sort in Assending order.

component.set("v.isAsc",true);

}else{

component.set("v.arrowDirection",'arrowdown');

component.set("v.isAsc",false);

}

// call the onLoad function for call server side method with pass sortFieldName

this.onLoad(component,event,sortFieldName);

},

})

See code comments.

TestApp.app

Lightning application code for Test component

1

2

3

4

5

6

7

8

<aura:application extends="force:slds">

<c:CustomSortingOnTable />

<!-- here c: is org. namespace prefix-->

</aura:application>

After the winter 17 release you can use the Lightning Design System style in Lightning Apps by extends=”fore:slds”. The Salesforce Lightning Design System provides a look & feel that’s consistent with Lightning Experience. Use Lightning Design System styles to give your custom applications a UI that is consistent with Salesforce.

Daisy Scott

Daisy is a technology expert adviser and Marketing head of a financial organization, based in California, USA. Her interest lies basically in indulging various latest technologies, to improve marketing. Being an expert technological adviser she also contributes and shares his live experience with latest tools about Salesforce Lightning.