• VVH
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 2
    Replies
How to have on click action for specific column in data table in lwc.
consder this as example, js: columns = [ {label: 'Opportunity name', fieldName: 'opportunityName', type: 'text'},
{label: 'Confidence', fieldName: 'confidence', type: 'percent', cellAttributes: { iconName: { fieldName: 'trendIcon' }, iconPosition: 'right' }} ];
I want to open a modal by clicking on Confidence.  if I give onclick in html, for example:  <lightning-datatable data={data} columns={columns}" onclick={openmodal}> </lightning-datatable>
In this case modal will open wherever Iclick on data-table, instead of specific column. 
Anyone know any solution for this?
Thanks in advance.
  • September 30, 2021
  • Like
  • 0
I'm trying to remove a column in lwc when certain condition is met. Is there any attribute or something from which i can make the visiblity of column true/false. 
@track hideCoulmn;
    @track columns = [
        {
            label: "column1",
            hideDefaultActions: "true",
            editable: false,
            sortable: false },
        {
            label: "column2",
            fieldName: "culomn2___c",
            type: "text",
            hideDefaultActions: "true",
            editable: false,
            sortable: false,
           //needs to be hidden when hideColumn=true
        },
so can i have @track property called @track hideCoulmn and make it true/false whenever i need and by that hide the column? is it possible?
  • August 09, 2021
  • Like
  • 0
I have a requirement like, there is a multi-select picklist field called 'Template' in object1. Values for this are coming from text field 'Template Name' of 'object2'.
Thers is another text field in 'object2' called 'Associate', for this field values should be the names of the object1 which have choosen that particular object2's 'Template Name'. How write a trigger to get the name of the object1 in 'Associate'.
Thanks in advance
  • July 06, 2021
  • Like
  • 0
 actions = [
        {label: 'Preview', name: 'Preview', disabled: true},
        {label: 'Remove', name: 'Remove', disabled: false}
    ];

   @track columns = [
        {
            type: 'action',
            typeAttributes: { rowActions: this.actions },
        },
        
    ];
    handleRowAction(event) {
        switch (actionName) {            
            case 'Remove':        
                  
                if(this.selectedRows.length>1){
                //make disabled true
                    
                }
                else{
                    //do something else
                }              
                
                break;
            default:
        }
    }
How to make disabled true in if condition? this.actions[1].disabled = true didnt work. Any other idea?
thanks in adavance
  • May 21, 2021
  • Like
  • 0
I want to disable some onrow action after meeting some criteria. The fuctionality is working fine as it's not permorning actions after disabling but i need to change the color. it should be greyed out when its disabled. how can this be done?
HTML:
                <c-custom-data-table
                class="apo-data-table__slds"
                key-field="index"
                data={tableData}
                columns={columns}
                onrowaction={handleRowAction}
                disabled={disableAction}
                editable="true"
                onsave={handleSave}
                oninputchanged={handleNameChange}
                sorted-by={sortBy}
                sorted-direction={sortDirection}
                onsort={doSorting}
                onrowselection={getSelectedRows}
               >
            </c-custom-data-table>
JS:
@track disableAction=true;
    handleRowAction(event) {

        switch (actionName) {
            case 'Preview':
                if(condition){
                    this.disableAction = false;
                    this.methodname(record_id);
                }
                
                break;
}
 
  • May 12, 2021
  • Like
  • 0
I have  a requirement to restrict special charcter in lwc. example code is
HTML:
<template>
    <lightning-input
        onchange={handleSpecialCharacter}        
    ></lightning-input>
</template>
JS:
handleSpecialCharacter(event){
        var specials=/[*|\":<>[\]{}`\\()';@&$]/;
        if (specials.test(event.target.value)){
            if(event.currentTarget.dataset.value === 'CustomField__c'){
                
                
                alert("Special Characters are not allowed ");
retrun false;
}
}
}

but after giving alert its still accepting special characters. anybody how to resolve this or how to ignore special chars
  • May 06, 2021
  • Like
  • 0
I'm trying to remove a column in lwc when certain condition is met. Is there any attribute or something from which i can make the visiblity of column true/false. 
@track hideCoulmn;
    @track columns = [
        {
            label: "column1",
            hideDefaultActions: "true",
            editable: false,
            sortable: false },
        {
            label: "column2",
            fieldName: "culomn2___c",
            type: "text",
            hideDefaultActions: "true",
            editable: false,
            sortable: false,
           //needs to be hidden when hideColumn=true
        },
so can i have @track property called @track hideCoulmn and make it true/false whenever i need and by that hide the column? is it possible?
  • August 09, 2021
  • Like
  • 0
I want to write trigger to enable a checkbox in contact whenever its Account is modified(updated). 
I'm not able to put the condition for Account updated or not! Can you guys provide the logic?? 
 
  • April 12, 2017
  • Like
  • 1