I'm displaying the picklist field using custom datatype picklist. I have to hide the particular field on certain row which eligible.

How I can achieve that?


2 Answers 2


You could try making a custom component and extending the data-table but... it's a lot of work and it's hard to get data out of the data table.

I'd just roll my own table.

<table role="grid" class="slds-table slds-table_cell-buffer slds-table_bordered slds-m-top_small">
    <tr class="slds-line-height_reset">

      <th scope="col" style="width: 200px">
        <div class="slds-truncate">Last Run Date</div>

      <th scope="col" style="max-width: 250px; ">
        <div title="Comments">Override Elegibility Check</div>
    <template for:each={rows} for:item="row" for:index="index">
    <tr onchange={handleRowChange} key={row.Id} tabindex="-1" class="slds-hint-parent" >

      <td class="slds-truncate" role="gridcell" tabindex="-1">

      <td class="slds-truncate" role="gridcell" tabindex="-1">
        <div style="padding-left: 0.75rem" if:true={row.hideSelect}>

        <div if:false={row.hideSelect}>
                      label="Override Elegibility Check"
                      placeholder="Select A Value"
                      options={elegibilityCheckOptions} ></lightning-combobox>


Note, you'll need to preprocess the data going into the table, to show and hide the combobox.

Next, handle the onchange event from the combobox in the row that holds it, and use it's data- attributes to mark which one the edit is coming from.

handleRowChange = (e) => {
  let id = e.target.dataset.id;
  let rawvalue = e.target.value;
  //do find the value using the id and update it.

So much easier that mucking about with extending the data-table - or disabling the combobox, which seems like only half fixing your problem (plus disabling stuff is always a problem - because you need to show people WHY you disabled something.


For this while fetching data for the data table from Apex class, you should have one flag field for each record which will decide whether you can show or hide that picklist field. And use this flag field in the column definition of custom picklist field for visibility. I hope this may help you.

  • I have the flag field but in the type attributes what should i mention to hide it.
    – Salesforce
    Dec 11, 2022 at 13:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .