July 2018
Beginner to intermediate
458 pages
9h 58m
English
The datatable component allows us to create a data table from an array of objects. The component sample code is shown as follows. The component creates a simple table, with the columns name ID, opportunity name, confidence, amount, email, and phone:
<aura:component> <aura:attribute name="mydata" type="Object"/> <aura:attribute name="mycolumns" type="List"/> <aura:handler name="init" value="{! this }" action="{! c.init }"/> <Lightning:datatable data="{! v.mydata }" columns="{! v.mycolumns }" keyField="id" onrowselection="{! c.getSelectedName }"/></aura:component>
The controller code illustrates an example with some mock data, as follows:
({ init: function(cmp, event, helper) { cmp.set('v.mycolumns', [{ label: ...Read now
Unlock full access