Help Center
  • What is GridMate
  • 📌Getting Started
    • Package Setup
    • Appexchange
  • 🎬Product Tour
    • Related List Grid
    • Parent Related List Grid
    • List View Grid
    • Kanban List View Grid
    • Field Set Grid
    • User Grid
    • Pivot Grid
    • Report Table
    • Multi Calendar
    • Object Timeline
    • File Explorer
    • Record Layout
    • Record KPI
    • Field Path
    • Map Record
    • Map List
    • Utility Bar Grid
    • Record App Switcher
    • Flow Grids
    • Compact Calendar
  • 🚀Advanced Guides
    • Grid - Advanced Configuration
    • Grid - Mass/Record Actions
    • Grid - Advanced Filtering
    • Grid - Inline Components
    • Grid - Mass Edit Button
    • Grid - Enhanced Filter Builder
    • Grid - Data Import Wizard
    • Grid - Dynamic Formula Field
    • Grid - Grid Explorer
    • Grid - Dynamic Interaction
    • Grid - Dynamic FieldSet Grid
    • Grid - Dynamic Record Card
    • Grid - Custom Action
    • Grid - Interactive Filters
    • Grid - Bulk Action
    • Grid - Custom Inline Component
    • Grid - Config Checker
    • Grid - Admin Cockpit
    • User Grid - Split View
    • User Grid - Data Filtering
    • User Grid - Deployment Process
    • Map List - Search Around Setup
    • Salesforce Classic Setup
  • 📦Package Reference
    • Components Library
      • GM - RelatedList Grid
      • GM - FieldSet Grid
      • GM - ListView Grid
      • GM - FieldSet Kanban
      • GM - ListView Kanban
      • GM - Parent RelatedList Grid
      • GM - RelatedList Tabs
      • GM - RelatedList Accordion
      • GM - RelatedList Cards
      • GM - Record Layout
      • GM - Record Layout (LWC)
      • GM - Record Card
      • GM - Dynamic Tabs
      • GM - Dynamic Accordion
      • GM - Flow Layout
      • GM - Field Path
      • GM - Multi Calendar
      • GM - FieldSet Pivot
      • GM - Flow View Grid
      • GM - Flow Edit Grid
      • GM - Record App Switcher
      • GM - Map Record
      • GM - Map List
      • GM - Report Table
      • GM - Object Timeline
      • GM - User Grid
      • GM - File Explorer
      • GM - Dynamic FieldSet Grid
      • GM - Dynamic Record Card
      • GM - User Grid Split View
      • GM - Compact Calendar
      • GM - Interaction Logger
    • Javascript Formulas
    • DataGrid Settings
  • Tools
    • SF Cli Plugin
    • Chrome Extension
  • 📬TROUBLESHOOTING
    • ⚙️Config Snippets
      • Layout - basic setup
      • Layout with read only field
      • Layout with field visibility
      • Layout with section visibility
      • Layout with autocomplete
      • Inline FieldSet Grid
      • Inline RelatedList Grid
      • Inline Record Layout
      • Inline Chatter Feed
      • Multiple Inline Components
      • Calendar - Extra Activities
      • Field Path Stages
      • Dynamic Tabs
      • Compact Calendar
      • Object Timeline
    • ❓FAQ
  • 📋Release Notes
Powered by GitBook

Links

  • Appexchange
  • Pricing
  • Solution

Social

  • Youtube
  • LinkedIn
  • X

2025 GridMate

On this page
  • Introduction
  • Aura Implementation
  • Aura Component
  • Inline Component Configuration
  • LWC Implementation
  • LWC Component
  • Inline Component Configuration

Was this helpful?

  1. Advanced Guides

Grid - Custom Inline Component

PreviousGrid - Bulk ActionNextGrid - Config Checker

Last updated 1 year ago

Was this helpful?

Introduction

All GridMate components can be used as just by configuration. However there is some situations where a custom component is required to address the business needs.

To address this type of use cases, you can implement your own Aura or LWC component. Both components should have recordId as an attribute.

If the component is an Aura component, it should be declared as a global as well as the recordId attribute.

Aura Implementation

Aura Component

Our use case is to display a relative date based on the close date like a timer. Let's go ahead and start our custom Aura component using Lightning Data Service and relativeDateTime lightning component.

<aura:component implements="force:hasRecordId" access="global">
    <aura:attribute name="style" type="String" access="global" />

    <aura:attribute name="recordData" type="Object" />
    <aura:attribute name="recordError" type="String" />
    <aura:attribute name="closeDate" type="Object" />

    <aura:handler name="change" value="{!v.recordData}" action="{!c.handleRecordDateChange}" />

    <force:recordData
        aura:id="recordData"
        recordId="{!v.recordId}"
        fields="Name,CloseDate"
        targetFields="{!v.recordData}"
        targetError="{!v.recordError}"
    />

    <aura:if isTrue="{! v.closeDate }">
        <div class="slds-align_absolute-center">
            Closing&nbsp;
            <span style="{!v.style}">
                <lightning:relativeDateTime value="{!v.closeDate}" />
            </span>
        </div>
    </aura:if>
</aura:component>
({
    handleRecordDateChange: function (component, event, helper) {
        component.set('v.closeDate', null);

        let recordData = component.get('v.recordData');
        if (recordData && recordData.CloseDate) {
            component.set('v.closeDate', new Date(recordData.CloseDate));
        }
    }
});

Inline Component Configuration

Our Aura component is ready. Let's go ahead and configure it as an inline component as below. Note that we can have dynamic attributes to customize the behavior per grid if needed. In our example, we are passing the style of the timer.

[
    {
        "component": "c:CloseDateTimerComponent",
        "attributes": {
            "style": "font-size:large;color:blue"
        }
    }
]

LWC Implementation

LWC Component

LWC is also an option to implement an inline component. Below is the LWC version of the Close Date Timer component implemented above.

The LWC component should be exposed. Otherwise it will not be visible to GridMate.

<template>
    <template if:true={closeDate}>
        <div class="slds-align_absolute-center">
            Closing&nbsp;
            <span style={timerStyle}>
                <lightning-relative-date-time value={closeDate}>
                </lightning-relative-date-time>
            </span>
        </div>
    </template>
</template>
import { LightningElement, api, wire } from 'lwc';

import { getRecord, getFieldValue } from 'lightning/uiRecordApi';

import CLOSE_DATE_FIELD from '@salesforce/schema/Opportunity.CloseDate';

export default class CloseDateTimerLWC extends LightningElement {
    @api recordId;
    @api timerStyle;

    @wire(getRecord, { recordId: '$recordId', fields: [CLOSE_DATE_FIELD] })
    recordData;

    get closeDate() {
        let oppCloseDate = getFieldValue(
            this.recordData.data,
            CLOSE_DATE_FIELD
        );

        if (oppCloseDate) {
            return new Date(oppCloseDate);
        }

        return null;
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>58.0</apiVersion>
    <isExposed>true</isExposed>
</LightningComponentBundle>

Inline Component Configuration

Let's go ahead and configure the inline component as below:

[
    {
        "component": "c:closeDateTimerLWC",
        "attributes": {
            "timerStyle": "font-size:large;color:blue"
        }
    }
]

And obviously we get the same result as a above.

🚀
inline components
Close Date Timer - Aura
Close Date Timer - LWC