Activity Forums Salesforce® Discussions In Salesforce, How do I get the Value of a ui:inputCheckBox Lightning Component?

  • Satyakam

    Member
    January 23, 2017 at 6:12 am

    Hi Tanu,

    In your Component if you are iterating a list of any object with input Checkbox field and you want to get values of selected checkbox on click of button:

    <aura:iteration items="{!v.AccountList}" var="opp">
    <tr>
    <td>
    <ui:inputCheckbox class="slds-checkbox" value="{!opp.selected}" />
    </td>
    <td><ui:outputText class="slds-output" value="{!opp.Accc.Name}"/></td>
    </tr>
    </aura:iteration>

    <ui:button class="slds-button slds-button--neutral " label="Add" press="{!c.addValue}"/>

    JsController:

    addValue : function(component, event, helper) {
    var accProList = component.get("v.AccountList");
    var selectedtLists = [];
    for(var i=0;i<accProList.length;i++){
    if(accProList[i].selected == true){
    selectedtLists.push(accProList[i].Accc.Name);
    }
    }

    }

    In this you have to use wrapper class in your apex controller.if you are getting any problem than please let me know.

    Thanks

    • This reply was modified 7 years, 11 months ago by  Satyakam.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos