Coder Social home page Coder Social logo

dualselect's Introduction

DualSelect

A new version of the MultiColumnSelect. Looks the same. Way better.

Deploy to Salesforce

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... :)

What it looks like:

DualSelect gif

To use, look at the DualSelect app. Eg:

<aura:application access="global" extends="force:slds" >
  <aura:attribute name="leftValues" type="Object[]" default="[
  {
    'label': 'Annual Review',
    'value': 'Annual Review'
  },
  {
    'label': 'Watching Market',
    'value': 'Watching Market'
  },
  {
    'label': 'Initial Contact',
    'value': 'Initial Contact'
  }
  ]"/>
    
  <div class="slds">
    <div class="slds-box">
      <c:DualSelect fieldName="Opportunity Stage" leftValues="{!v.stagenames}" />
    </div>     
  </div>
</aura:application>

You can:

  • Drag from source to destination
  • Drag from destination to source
  • Dragging will attempt to put the item where you dropped it.
  • Drag to reorder in any list
  • Shift select several items in source or destination, then use the arrow buttons to move to either source or destination
  • Highlight an item and use the up / down buttons to move up and down.

At this point the component is very lightweight - you are required to pass in the source list. When the selected items list changes, the component emits an event called "multiColumnSelectChange" of type "c:DataChange_CE" The changed items will be in data.items parameter on the event.

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:

Add:

<aura:handler name="change" value="{!v.leftValues}" action="{!c.doInit}"/>

Remove:

<aura:handler name="init" value="{!this}" action="{!c.doInit}" />

Enjoy!

dualselect's People

Contributors

rapsacnz avatar vc4u avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.