• Navdeep Singh 95
  • NEWBIE
  • 0 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
I have used lightning data table for my custom object, no data got displayed in the table
html
<template>
    <h2> Project Datatable</h2>
    <template if:true={accList}>
        <lightning-datatable data={accList} columns={columns} key-field="Id">
        </lightning-datatable>
    </template>
    <template if:true={error}>
        {error}
    </template>
</template>

JS
import { LightningElement ,api, wire, track} from 'lwc';
import getAccountList from '@salesforce/apex/PriceFetch.getAccountList';
export default class PriceScreen extends LightningElement {
    @track columns = [{
           api: 'BuildingNo__c',
            label: 'BuildingNo',
            fieldName: 'BuildingNo',
            type: 'text',
            sortable: true
        },
        {   api:'Location__c',
            label: 'Location',
            fieldName: 'Location',
            type: 'text',
            sortable: true
        }
    
    ];
 
    @track error;
    @track accList ;
    @wire(getAccountList)
    wiredAccounts({
        error,
        data
    }) {
        if (data) {
            this.accList = data;
        } else if (error) {
            this.error = error;
        }
    }
}
PriceFetch.cls (Apex class)
public with sharing class PriceFetch {
    @AuraEnabled(cacheable=true)
    public static List<Project__c> getAccountList() {
        return [SELECT Id,BuildingNo__c, Location__c
            FROM Project__c];
    }
}
 An empty table is the output, Please helpme
Hi,
I have written the apex class for addition of two numbers. but for writing the test class i have issue.
Program is
--------------
public class Add 
{    
public integer a;
public integer b;
public integer c;
public integer addt()
{
    c=a+b; 
    system.debug('the result is'+c);
    return c;
}      
}

My test class
-----------------
@istest
public class Addtest
{
static testmethod void testadd()
{
    Add ad=new Add();
    integer res=ad.addt();
    system.assertEquals(res);
}
}
the test class is throwing error as
"Method does not exist or incorrect signature: void assertEquals(Integer) from the type System"

Any guidance please

Thanks in advance.