• K Vijendhar 1
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
hello everyone, 

can someone please help me to fix the following issue lighting web component, 

1) i am using soql query to get the records from the salesforce wiring in javascript. 
    here i have one field --> selection__c,
    now my requirement is if the selection is true then i have to table row in green if its false need to show color in red;
    now my code is like below
    
    
<table>
        <th>
          <td> name <td>
          <td> name <td>
          <td> name <td>
          <td> name <td>
        <th>
        <templete if:true ={selection">
            
              <tr style="background:lightpink;> 
            <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>              </tr>
                  
            <tr>
            </templete>
            <templete if:false ={selection">
            
              <tr style="background:green;>  
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
                  
            <tr>
            </templete>


    now my requirement is, I don't want to use the same code under the template for false and true conditions, 
    i will have to select the color based on the true or false condition. 
    
    can someone please suggest me how to achieve it in lighting web component 
your help is appreciated, thanks for your help advance.