+ Start a Discussion

ligthning:dataTable not displaying correctly

Hello ,

I have a ligthning:dataTable not displaying correctly.

There is no header visible and also data is not visible.
Please explain why.
<aura:if isTrue="{!v.showCsResults}">          	
            <lightning:datatable data="{!v.csResults}" columns="{!v.csResultsColumns}" keyField="siret" hideCheckboxColumn="true" onrowaction="{!c.siretiser}" />
init: function (component, event, helper) {
        //This method is called on initialization
        //It formats the lightning:dataTable that will display the CS results with the appropriate columns and data types
         var actions = [
            { label: 'Sirétiser', name: 'siretiser' },
        component.set('v.csResultsColumns', [
             		{label: 'Siret', 							fieldName: 'siret', 	type: 'text'},
            		{label: 'Nom du Compte', 					fieldName: 'nomCompte', type: 'text'},
                    {label: 'Rue', 								fieldName: 'rue', 		type: 'text'},
            		{label: 'CP', 								fieldName: 'cp', 		type: 'text'},
            		{label: 'Ville', 							fieldName: 'ville', 	type: 'text'},
            		{ type: 'action', typeAttributes: { rowActions: actions } }

var csresults = new Array();
					for (var item of results.companies) {
                        var csresult = new Object();
                        csresult.siret = item.regNo;
                        csresult.nomCompte = item.name;
                        csresult.rue = item.address.street;
                        csresult.cp = item.address.postalCode;
                        csresult.ville = item.address.city;
                    component.set('v.csResults', csresults);
                    component.set('v.showCsResults', true);

Best Answer chosen by bretondev
Hi  bretondev,

issue is with UI please provide your css too 
try these CSS
.THIS.slds - scrollable_y {
    min - height: 150 px
component as
<div tabindex="-1" class="slds-scrollable_y" style="width: 902px;">
    <table role="grid" class="slds-table ...

Mark as resloved if it helps :) :)
Bhanu Prakash
visit ForceLearn.com