You need to sign in to do that
Don't have an account?
Akhil Katkam 5
How to display only one specific record value with aura iteration for table view
Hi Developer Community,
i have a requriement for my task ,
i want to display a custom object record using table slds attribute ,
but i want to display only one particular record from that custom object
how to do that , i have already written some code , but it is displaying all records
my code:
.cmp: <aura:attribute name="CompetingProduct" type="ciboostc1501__Competing_Product__c" /> <aura:handler name="init" action="{!c.doInit}" value="{!this}"/> <lightning:card title="Personas"> <aura:set attribute="body"> <table class="slds-table slds-table_bordered slds-table_cell-buffer"> <thead> <tr class="slds-text-title_caps"> <th scope="col">Personas</th> <th scope="col">Key Message</th> </tr> </thead> <tbody> <aura:iteration items="{!v.CompetingProduct}" var="comp"> <tr scope="row"> <td>{!comp.ciboostc1501__Persona1__c}</td> <td>{!comp.ciboostc1501__Key_message_1__c}</td> </tr> </aura:iteration> </tbody> </table> </aura:set> </lightning:card> --------------------------------------------------------------------------------------------------- controller.js : ({ doInit: function(component, event, helper) { var action = component.get("c.getDetails"); action.setCallback(this, function(data) { component.set("v.CompetingProduct", data.getReturnValue()); console.log(data.getReturnValue()); }); $A.enqueueAction(action); } }) ------------------------------------------------------------------------------------------------ apex class : public class competingclass { @AuraEnabled public static List<ciboostc1501__Competing_Product__c> getDetails(){ return [SELECT ciboostc1501__Persona1__c,ciboostc1501__Key_message_1__c FROM ciboostc1501__Competing_Product__c]; } }
can anyone please tell me how to display only one particular record
Thanks in Advacnce
Try Below Code
Greetings!
If you want to display any one custom record, then use this SOQL query-
Otherwise, for a particular single record, you have to add where clause to your SOQL to identify the particular record.
For example record Name, or Maybe identify by Id- If you find your Solution then mark this as the best answer.
Thank you!
Regards,
Suraj Tripathi
Glad to be of help.
Please mark the answer as the best answer to keep this community clean and for other help.
Thanks and Regards
Suraj Tripathi.
Please Close Your Query By Marking It As Best Answer
Thank You!