+ Start a Discussion
SharathKumar ReddySharathKumar Reddy 

How to display multi-picklist values as checkboxes in lightning component

How to display multi-picklist values as checkboxesin lightning component
Mohd  RaisMohd Rais
Hi SharathKumar,
Please try this code it's will help you.
you can create any apex method to get picklist value.
<!-- multi-select picklist -->
--------Component--------------------

<aura:attribute name="PicklistOptions" type="List"/>
<aura:attribute name="PicklistValue" type="List"/>
<lightning:checkboxGroup name="Select picklist" aura:id="pickListId"
					 label="Pick list Name"
					options="{! v.PicklistOptions}"
					 value="{!v.PicklistValue }"
					 onchange="{!c.addPickListValue}"
						/>
-----------component controller----------------------

addPickListValue: function (c, e, h) {
	var PicklistValue = c.get('v.PicklistValue');
	var text = '';
	if (PicklistValue.length > 0) {
		for (var i = 0; i < PicklistValue.length; i++) {
			if (i == 0) {
				text = PicklistValue[i];
			}
			else {
				text = text + ';' + PicklistValue[i];
			}
		}
	}
	ObjectAtrribute.picklistfieldApiName = text;
	c.set("v.ObjectAtrribute", ObjectAtrribute);
},
-----------component helper----------------------

doInit_Helper: function (c, e, h) {
var action = c.get("c.getpicklistMethodApex");
		action.setCallback(this, function (response) {
			var state = response.getState();
			if (state === "SUCCESS") {

if (returnResult.piclistOptions != undefined) {
					var list = [];
					for (var i = 0; i < returnResult.piclistOptions.length; i++) {
						var obj = {};
						obj.label = returnResult.piclistOptions[i].label;
						obj.value = returnResult.piclistOptions[i].value;
						list.push(obj);
					}
					c.set("v.PicklistOptions", list);
				}
				
			}
		}
}

Mohd Rais

Thanks