function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matyas CsabaMatyas Csaba 


Hello Helper

I hope  I am asking my  questin  in the rith place. It  is about lightning 

I am using lightning:datatable  component  to display  data  retrieved  from a custom object.  I was able to  set  the columns  and the data  but I can not  see properly  field of type checkbox

    <lightning:datatable data="{!v.mydata}" 

        component.set('v.mycolumns', [
        {label: 'Team Member', fieldName: 'Name__c', type: 'text'},
        {label: 'Reason', fieldName: 'Assignment_Reason__c', type: 'text'},
        {label: 'Channel', fieldName: 'Channel__c', type: 'text'}, 
        {label: 'Active', fieldName: 'Active__c', type: 'checkbox'}     

I suspect the problem is  with the type  of the column

any  idea/suggestions?

Thanks in advance
Raj VakatiRaj Vakati
Check box is not supported as per the documents .  go to this link 
<salesforce URL >/componentReference/ 
Refer  Formatting with Data Types

The data table determines the format based on the type you specify. Each data type is associated to a base Lightning component. For example, specifying the text type renders the associated data using a lightning:formattedTextcomponent. Some of these types allow you to pass in the attributes via the typeAttributes property to customize your output. For supported attribute values, refer to the component's reference documentation. Valid data types and their supported attributes include:
You can find ready to use lightning data table component example here: This component do support multiple field types.
Ashutosh kumar yadavAshutosh kumar yadav
Lightning:datatable example
<aura:component controller="AccountController1">
   <aura:attribute name="createAcc" type="Account" default="{'sObjectType' : 'Account','Name' : ''}"/>
    <aura:attribute name="objName" type="String" default="Account"/>
    <aura:attribute name="fldName" type="String" default="Rating"/>
   <aura:attribute type="Account[]" name="acctList"/>
    <aura:attribute name="mycolumns" type="List"/>
    <aura:handler name="init" value="{!this}" action="{!c.fetchAcc}"/>
    <div class="slds-p-around_small">
        <lightning:input type="Text" label="Name" value="{!v.createAcc.Name}"/>
        <lightning:input type="Text" label="Account Number" value="{!v.createAcc.AccountNumber}"/>
        <lightning:input type="Email" name="email2" value="{!v.createAcc.Email}" label="Email ID"/>
        <lightning:input type="Phone" label="Phone Number" value="{!v.createAcc.Phone}"/>
        <lightning:select label="Rating" value="{!v.createAcc.Rating}">
            <option value="">—None—</option>
            <aura:iteration items="{!v.ratingList}" var="ac">
                <option value="{!ac}">{!ac}</option>
        <lightning:button label="Save" iconPosition="left" variant="brand" onclick="{!c.doSave}"/>
        <lightning:button label="Cancel" iconPosition="right" variant="destructive" onclick="{!c.docancel}"/>
    <lightning:datatable data="{! v.acctList }"
                         columns="{! v.mycolumns }"


   fetchAcc : function(component, event, helper) {
        helper.fetchAccHelper(component, event, helper);
      doSave : function(component, event, helper) {
        var action = component.get('c.createAccount');
            ac : component.get('v.createAcc')
            var getAllValue = component.get('v.createAcc');
    docancel : function(component, event, helper) {


    fetchAccHelper : function(component, event, helper) {
        component.set('v.mycolumns', [
            {label: 'Account Name', fieldName: 'Name', type: 'text'},
                {label: 'Industry', fieldName: 'Industry', type: 'text'},
                {label: 'Phone', fieldName: 'Phone', type: 'Phone'},
                {label: 'Website', fieldName: 'Website', type: 'url '}
        var action = component.get("c.fetchAccounts");
        action.setCallback(this, function(response){
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.acctList", response.getReturnValue());

<aura:application extends="force:slds">


public class AccountController1
    public static List <Account> fetchAccounts() {
        //Qyery 10 accounts
        List<Account> accList = [SELECT Id, Name, BillingState, 
                                    Website, Phone, Industry, Type from Account ];
        //return list of accounts
        return accList;
 /*    @AuraEnabled
    public static List<String> getPickList(String objName,String fldName) {
        List<String> pkList = new List<String>();Map<String,Schema.SObjectType> allObj = Schema.getGlobalDescribe();
        Map<String,Schema.SObjectField> allFlds = allObj.get(objName).getDescribe().fields.getMap();
        List<Schema.PicklistEntry> pickList = allFlds.get(fldName).getDescribe().getPickListValues();
        for(Schema.PicklistEntry pk : pickList){
        return pkList;
    }   */
    public static Account createAccount(Account ac){
        insert ac;
        return ac;