• Shavi Dabgotra
  • NEWBIE
  • 65 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 12
    Replies

Hello experts!
I want an Icon in row actions of lighting- data table in LWC.

User-added imageIcon should be display in red mark. How to add it?

Thank you in advance! 

 

Hi all,
I want a drop down menu by using lightning-button-menu in  data table using Lightning Web component.
I have created the Data table and I want a drop down menu with the different values. 
Data table is as follows:

HTML:
<template>
    <lightning-card title='Data table'>
       
    <div style="height: 300px;">
        <lightning-datatable
                key-field="id"
                data={data}
                columns={columns}
                >
        </lightning-datatable>
        <div>{error}</div>
    </div>
</lightning-card>    
</template>
JS:
import { LightningElement,track,api,wire } from 'lwc';
import getAccountList from '@salesforce/apex/AccountHelper.getAccountList';
const columns = [
    { label: 'Account name',
    fieldName: 'Name',
    type: 'text',
    sortable: true
    },
    {
        label: 'Type',
        fieldName: 'Type',
        type: 'text',
        sortable: true
    },
        
];
export default class Test extends LightningElement {
    data = [];
    columns = columns;
    wiredActivities ;
    records = '';
    error;
    @wire(getAccountList,{
        }
    )
    wiredCases(value){
        this.wiredActivities = value;
        const { data, error } = value;
    
    if(data){
        let dataEditing = JSON.parse(JSON.stringify(data));
        this.records = dataEditing.length;
        this.data = dataEditing;
        
    }else if(error){
        this.error = error;
    }
    
}
}
Apex class: 
public with sharing class AccountHelper {
    @AuraEnabled(cacheable=true)
    public static List<Account> getAccountList() {
        return [SELECT Id, Name, Type, Rating,
                Phone, Website, AnnualRevenue
            FROM Account LIMIT 10];
    }
}

I want a drop down menu in every row and that should be clickable.
Thank you in advance!

Hi,
I have created a drop down menu in lightning web component. But, I want a pop up will appear on click of a menu item. 
I tried this for pop up, But it is not working. On click of a "Rename " Menu item . A pop up will be shown.

button.html

<template>
    <div class="slds-p-around_medium lgc-bg">
        {selectedItemValue}
        {ready}
        <lightning-card title="Drop Down">
            <lightning-button-menu alternative-text="Show menu" variant="border-filled" onselect={handleOnselect}>
                {selectedItemValue}
                <lightning-menu-item value="openinsharepoint" label="Open in SharePoint" prefix-icon-name="utility:new_window"
                    href="#"
                    target="_blank">
                </lightning-menu-item>
                <lightning-menu-item value="rename" label="Rename" prefix-icon-name="utility:edit">
                    <template if:true={ready}>
                        <section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open slds-modal_small"
                            aria-labelledby="modal-heading-01" aria-modal="true" aria-hidden="true"
                            aria-describedby="modal-content-id-1">
                            <div class="slds-modal__container">
                                <!-- Modal/Popup Box LWC header here -->
                                <header class="slds-modal__header">
                                    <button class="slds-button slds-button_icon slds-modal__close slds-button_icon-inverse" title="Close" onclick={closeModal}>
                                        <lightning-icon icon-name="utility:close"
                                            alternative-text="close"
                                            variant="inverse"
                                            size="small" ></lightning-icon>
                                        <span class="slds-assistive-text">Close</span>
                                    </button>
                                    <h2 id="modal-heading-01" class="slds-text-heading_medium slds-hyphenate">Rename LWC Setup.docx</h2>
                                </header>
                                <!-- Modal/Popup Box LWC body starts here -->
                                <div class="slds-modal__content slds-p-around_medium" id="modal-content-id-1">
                                    <lightning-input type="text" name="folder_name" label="Rename" placeholder="Enter new item name">
                                    </lightning-input>
                                </div>
                                <!-- Modal/Popup Box LWC footer starts here -->
                                <footer class="slds-modal__footer">
                                    <button class="slds-button slds-button_neutral" onclick={closeModal} title="Cancel">Cancel</button>
                                    <button class="slds-button slds-button_brand" onclick={submitDetails} title="Create">Create</button>
                                </footer>
                            </div>
                        </section>
                        <div class="slds-backdrop slds-backdrop_open"></div>
                    </template>
                </lightning-menu-item>
                <lightning-menu-item value="download" label="Download" prefix-icon-name="utility:download">
                </lightning-menu-item>
                <div class="slds-has-divider_top-space" role="separator">
                    <lightning-menu-item value="delete" label="Delet" prefix-icon-name="utility:close"></lightning-menu-item>
                </div>
            </lightning-button-menu>
        </lightning-card>
    </div>
</template>

button.js

import { LightningElement, track } from 'lwc';
export default class ButtonMenuOnselect extends LightningElement {
    @track selectedItemValue;
    @track ready;
    handleOnselect(event) {
        this.selectedItemValue = event.detail.value;
        if(this.selectedItemValue == "rename")
        {
        alert("ready");
        this.ready = true;
        alert("false");
        }
        
    }
}

 

Hi Everyone,
I want to display the field from my custom object(Timesheet__c), To be display in Visualforce using Custom controller. 

Below is my VF: 
<apex:page controller="ManagementTime" lightningStylesheets="true" >
    <apex:form >
        <apex:pageBlock >
           <apex:pageblockSection columns="1" >
               <apex:pageblockTable value="{!objlist}"  var="c" >
                   <apex:column headervalue="Task"  >
                      <apex:inputField value="{!c.Task_Type__c}"/>
                       <apex:outputField value="{!c.Task_Type__c}" /> 
                   </apex:column> 
                   <apex:column headervalue="Monday" rendered="true" >
                      <apex:inputField value="{!c.Monday__c}"/>
                       <apex:outputField value="{!c.Monday__c}" /> 
                   </apex:column> 

               </apex:pageBlockTable>
            </apex:pageblockSection>     
        </apex:pageBlock>
    </apex:form>
</apex:page>

Below is my Custom controller: 

public class ManagementTime{
    public list<Timesheet__c> objlist {get;set;}
    public ManagementTime(){
        objlist = [SELECT Id, Task_Type__c FROM Timesheet__c WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }
}

But I my getting only header name:

User-added image


But I want like this: 

User-added image

Could someone help me in this? I am new to visualforce development.Thank you in advance!

Hi everyone,
I have created a process as mentioned in the Challenge. As I attached my process. 
User-added image
User-added imageBut I am getting error saying ,
User-added image

Can someone help me in this? 
Thank you in advance!

I have a requirement in which when the Billing State is Punjab then a custom checkbox(Exists__c should be true) on Account Object. Billing State is a picklist.
I have used Trigger to update that.
trigger ASCExists on Account (after update) {
    if(trigger.isAfter && trigger.isUpdate){
        for(Account acc:trigger.new){
            if(acc.BillingCountry == 'India' && acc.BillingState == 'Punjab' )
            {
                acc.Exists__c = true ;
                update acc;
            }
        }
    }
}
But I am getting this error as:
Error:Apex trigger ASCExists caused an unexpected exception, contact your administrator: ASCExists: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.ASCExists: line 6, column 1

How to fix this. Can somebody help in this.
Thank you 
Hi everyone!

I have created a checkbox on opportunity as 'IsDeleted'. Whenever user mark this checkbox as true, opportunity record should get deleted.
I am new to apex trigger. Can someone help me?
Thank you