Created
January 20, 2020 18:31
-
-
Save cchrisv/818ad8f6639a1097d8164215588316d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
datatableFSC Lightning Flow Screen Component | |
Enhanced by Eric Smith - 3/9/19 | |
Version: 2.7 (11/30/19) | |
4/8/19 - ers New parameter to Show/Hide Checkboxes | |
New parameter for # of selectable rows (Set number of selectable rows to 1 for Radio Buttons) | |
Provide an input collection to the Output Selected parameter to pre-select rows | |
11/27/19 - bkv Editable Columns (Save changes in Flow) | |
11/27/19 - ers Added Save/Cancel functionality while editing | |
Created to display a datatable in a Flow screen | |
Supports: | |
Up to 8 predefined Standard or Custom objects | |
Up to 10 columns | |
All columns are sortable | |
Parameters for Column Width and Alignment | |
Optional Checkboxes or Radio Buttons | |
Pre-selected Rows | |
To change the predefined Objects, edit the Object names in datatableFSC.cmp and in datatableFSC.design | |
--> | |
<aura:component implements="lightning:availableForFlowScreens"> | |
<aura:attribute name="obj" type="String" /> | |
<aura:attribute name="mydata" type="SObject[]"/> | |
<aura:attribute name="saveMydata" type="SObject[]"/> | |
<aura:attribute name="selectedRows" type="SObject[]"/> | |
<aura:attribute name="sortedBy" type="String" /> | |
<aura:attribute name="sortedDirection" type="String" /> | |
<aura:attribute name="maxRowSelection" type="String" /> | |
<aura:attribute name="hideCheckboxColumn" type="Boolean" default="false" /> | |
<aura:attribute name="preSelection" type="SObject[]" /> | |
<aura:attribute name="preSelectedIds" type="List" /> | |
<!-- CHANGE THE OBJECT NAMES HERE AND IN THE DESIGN FILE TO SUPPORT DIFFERENT OBJECTS --> | |
<aura:attribute name="mydata_standard1" type="TimeSlot__c[]"/> | |
<aura:attribute name="selectedRows_standard1" type="TimeSlot__c[]"/> | |
<aura:attribute name="mycolumns" type="List"/> | |
<aura:attribute name="column01_icon" type="String"/> | |
<aura:attribute name="column01_label" type="String"/> | |
<aura:attribute name="column01_fieldName" type="String"/> | |
<aura:attribute name="column01_type" type="String" default="text"/> | |
<aura:attribute name="column01_width" type="Integer"/> | |
<aura:attribute name="column01_align" type="String"/> | |
<aura:attribute name="column01_editable" type="Boolean" default="false"/> | |
<aura:attribute name="column02_label" type="String"/> | |
<aura:attribute name="column02_fieldName" type="String"/> | |
<aura:attribute name="column02_type" type="String" default="text"/> | |
<aura:attribute name="column02_width" type="Integer"/> | |
<aura:attribute name="column02_align" type="String"/> | |
<aura:attribute name="column02_editable" type="Boolean" default="false"/> | |
<aura:attribute name="column03_label" type="String"/> | |
<aura:attribute name="column03_fieldName" type="String"/> | |
<aura:attribute name="column03_type" type="String" default="text"/> | |
<aura:attribute name="column03_width" type="Integer"/> | |
<aura:attribute name="column03_align" type="String"/> | |
<aura:attribute name="column03_editable" type="Boolean" default="false"/> | |
<aura:attribute name="column04_label" type="String"/> | |
<aura:attribute name="column04_fieldName" type="String"/> | |
<aura:attribute name="column04_type" type="String" default="text"/> | |
<aura:attribute name="column04_width" type="Integer"/> | |
<aura:attribute name="column04_align" type="String"/> | |
<aura:attribute name="column04_editable" type="Boolean" default="false"/> | |
<aura:attribute name="column05_label" type="String"/> | |
<aura:attribute name="column05_fieldName" type="String"/> | |
<aura:attribute name="column05_type" type="String" default="text"/> | |
<aura:attribute name="column05_width" type="Integer"/> | |
<aura:attribute name="column05_align" type="String"/> | |
<aura:attribute name="column05_editable" type="Boolean" default="false"/> | |
<aura:attribute name="column06_label" type="String"/> | |
<aura:attribute name="column06_fieldName" type="String"/> | |
<aura:attribute name="column06_type" type="String" default="text"/> | |
<aura:attribute name="column06_width" type="Integer"/> | |
<aura:attribute name="column06_align" type="String"/> | |
<aura:attribute name="column06_editable" type="Boolean" default="false"/> | |
<aura:attribute name="column07_label" type="String"/> | |
<aura:attribute name="column07_fieldName" type="String"/> | |
<aura:attribute name="column07_type" type="String" default="text"/> | |
<aura:attribute name="column07_width" type="Integer"/> | |
<aura:attribute name="column07_align" type="String"/> | |
<aura:attribute name="column07_editable" type="Boolean" default="false"/> | |
<aura:attribute name="column08_label" type="String"/> | |
<aura:attribute name="column08_fieldName" type="String"/> | |
<aura:attribute name="column08_type" type="String" default="text"/> | |
<aura:attribute name="column08_width" type="Integer"/> | |
<aura:attribute name="column08_align" type="String"/> | |
<aura:attribute name="column08_editable" type="Boolean" default="false"/> | |
<aura:attribute name="column09_label" type="String"/> | |
<aura:attribute name="column09_fieldName" type="String"/> | |
<aura:attribute name="column09_type" type="String" default="text"/> | |
<aura:attribute name="column09_width" type="Integer"/> | |
<aura:attribute name="column09_align" type="String"/> | |
<aura:attribute name="column09_editable" type="Boolean" default="false"/> | |
<aura:attribute name="column10_label" type="String"/> | |
<aura:attribute name="column10_fieldName" type="String"/> | |
<aura:attribute name="column10_type" type="String" default="text"/> | |
<aura:attribute name="column10_width" type="Integer"/> | |
<aura:attribute name="column10_align" type="String"/> | |
<aura:attribute name="column10_editable" type="Boolean" default="false"/> | |
<aura:attribute name="singleSelection" type="String" /> | |
<aura:attribute name="hideShow" type="String" default="show"/> | |
<aura:attribute name="keyField" type="String" default="Id"/> | |
<aura:attribute name="showButtons" type="Boolean" default="false"/> | |
<aura:handler name="init" value="{! this }" action="{! c.init }"/> | |
<aura:if isTrue="{! v.showButtons}" > | |
<lightning:datatable aura:id="flowTable" data="{! v.mydata }" | |
columns="{! v.mycolumns }" | |
keyField="{! v.keyField }" | |
sortedBy="{! v.sortedBy }" | |
sortedDirection="{! v.sortedDirection }" | |
maxRowSelection="{! v.maxRowSelection }" | |
selectedRows="{! v.preSelectedIds }" | |
onrowselection="{! c.getSelectedName }" | |
hideCheckboxColumn="{! v.hideCheckboxColumn }" | |
onsort="{! c.updateColumnSorting }" | |
onsave="{! c.handleSave }" | |
oncancel="{! c.cancelChanges }"/> | |
<aura:set attribute="else"> | |
<lightning:datatable aura:id="flowTable" data="{! v.mydata }" | |
columns="{! v.mycolumns }" | |
keyField="{! v.keyField }" | |
sortedBy="{! v.sortedBy }" | |
sortedDirection="{! v.sortedDirection }" | |
maxRowSelection="{! v.maxRowSelection }" | |
selectedRows="{! v.preSelectedIds }" | |
onrowselection="{! c.getSelectedName }" | |
hideCheckboxColumn="{! v.hideCheckboxColumn }" | |
onsort="{! c.updateColumnSorting }" | |
suppressBottomBar="true" | |
oncellchange="{! c.handleSave }"/> | |
</aura:set> | |
</aura:if> | |
</aura:component> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment