Skip to main content

Current Time Sheet Printing is >>>> {"id":"26ce6dac-010e-4c5a-a886-a8ae03b9403c","picklistoptions":[{"label":"CEC","value":"CEC"},{"label":"TCP","value":"TCP"},{"label":"Holiday","value":"Holiday"},{"label":"Timeoff","value":"Timeoff"}],"taskpicklistoptions":[{"label":"Development","value":"Development"},{"label":"Testing","value":"Testing"},{"label":"Holiday","value":"Holiday"},{"label":"Certification","value":"Certification"},{"label":"Timeoff","value":"Timeoff"}],"03/01/2024":"9","03/02/2024":0,"03/03/2024":0,"03/04/2024":0,"03/05/2024":0,"03/06/2024":0,"03/07/2024":0,"03/08/2024":0,"03/09/2024":0,"03/10/2024":0,"03/11/2024":0,"03/12/2024":0,"03/13/2024":0,"03/14/2024":0,"03/15/2024":0,"total":9}

 

I have used a custom data type and configured a picklist in my datatable however after selecting the value from the picklist in the datatable where does the selected value stores?? above i sthe current row which is being edited taskpicklistoptions and picklistoptions is showing as a whole array of picklistvalues 

 

#Datatable

1 个回答
  1. 2024年3月5日 10:04

    Hi @Macha Bharath Kumar,

    Hope you are doing well,

    In a Lightning web component with a data table in Salesforce, when you select a value from a picklist in a data table, the selected value is typically stored in the corresponding field in the underlying data. This field should be part of the data structure that you've defined for your data table.

    the selected value is not explicitly stored in the current data structure. To make this work, you should add a property to your data structure to store the selected picklist value.

    For example, you could add a property like selectedPicklistValue:

     

    {

      "id": "26ce6dac-010e-4c5a-a886-a8ae03b9403c",

      "picklistoptions": [

        {"label": "CEC", "value": "CEC"},

        {"label": "TCP", "value": "TCP"},

        {"label": "Holiday", "value": "Holiday"},

        {"label": "Timeoff", "value": "Timeoff"}

      ],

      "taskpicklistoptions": [

        {"label": "Development", "value": "Development"},

        {"label": "Testing", "value": "Testing"},

        {"label": "Holiday", "value": "Holiday"},

        {"label": "Certification", "value": "Certification"},

        {"label": "Timeoff", "value": "Timeoff"}

      ],

      "03/01/2024": {

        "value": "9",

        "selectedPicklistValue": null

      },

      "03/02/2024": {

        "value": 0,

        "selectedPicklistValue": null

      },

      // ... other date properties ...

      "total": 9

    }

     

    Now, when a user selects a value from the pick list in the data table, you can update the selectedPicklistValue property in the corresponding date entry.

    Hope this content will provide more understandinging to you,

    Thanks!

     

     

0/9000