Skip to content

Commit dbad439

Browse files
authored
Update README.md
1 parent 2908a1b commit dbad439

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,53 @@
11
# DualSelect
22
A new version of the MultiColumnSelect. Looks the same. Way better.
3+
4+
The structure of the component is more modular - The main `DualSelect` component is made up of two `OrderedList` components which handle all the dragging, dropping moving via events (I've done this via appliation events but am thinking of moving to component events - it does add a dependency on the parent `DualSelect` component, but I suppose there is a pretty heavy depency anyway... :)
5+
6+
To use, look at the DualSelect app. Eg:
7+
8+
<aura:application access="global" extends="force:slds" >
9+
<aura:attribute name="leftValues" type="Object[]" default="[
10+
{
11+
'label': 'Annual Review',
12+
'value': 'Annual Review'
13+
},
14+
{
15+
'label': 'Watching Market',
16+
'value': 'Watching Market'
17+
},
18+
{
19+
'label': 'Initial Contact',
20+
'value': 'Initial Contact'
21+
}
22+
]"/>
23+
24+
<div class="slds">
25+
<div class="slds-box">
26+
<c:DualSelect fieldName="Opportunity Stage" leftValues="{!v.stagenames}" />
27+
</div>
28+
</div>
29+
</aura:application>
30+
31+
You can:
32+
- Drag from source to destination
33+
- Drag from destination to source
34+
- Dragging will attempt to put the item where you dropped it.
35+
- Drag to reorder in any list
36+
- Shift select several items in source or destination, then use the arrow buttons to move to either source or destination
37+
- Highlight an item and use the up / down buttons to move up and down.
38+
39+
At this point the component is very lightweight - you are required to pass in the source list.
40+
When the selected items list changes, the component emits an event called "multiColumnSelectChange" of type "c:DataChange_CE"
41+
The changed items will be in data.items parameter on the event.
42+
43+
**NOTE** If you need to set the list source values dynamically, it's best to set them to the source list in one go and use a handler (in the inner ordered list component) to detect the data change, in turn calling the init method:
44+
45+
Add:
46+
47+
<aura:handler name="change" value="{!v.leftValues}" action="{!c.doInit}"/>
48+
49+
Remove:
50+
51+
<aura:handler name="init" value="{!this}" action="{!c.doInit}" />
52+
53+
Enjoy!

0 commit comments

Comments
 (0)