• WHO WE ARE
  • WHAT WE DO
    • Salesforce
      • Implementations
        • Sales Cloud
        • Service Cloud
        • CPQ
        • Field Service Lightning
        • Field Service for SMEs
      • Developments
        • Salesforce Customization
        • Custom Application Development
        • AppExchange Product Development
      • Migrations
        • Classic to Lightning Migration
        • Other Systems to Salesforce Migration
      • Integrations
    • Data Science
      • BI Solutions
      • AI/ML solutions
      • Agentic AI
  • HOW WE DO
    • Delivery Model
    • Our Works
  • REACH US
    • Contact Us
    • Careers
  • BLOG
    • WHO WE ARE
    • WHAT WE DO
      • Salesforce
        • Implementations
          • Sales Cloud
          • Service Cloud
          • CPQ
          • Field Service Lightning
          • Field Service for SMEs
        • Developments
          • Salesforce Customization
          • Custom Application Development
          • AppExchange Product Development
        • Migrations
          • Classic to Lightning Migration
          • Other Systems to Salesforce Migration
        • Integrations
      • Data Science
        • BI Solutions
        • AI/ML solutions
        • Agentic AI
    • HOW WE DO
      • Delivery Model
      • Our Works
    • REACH US
      • Contact Us
      • Careers
    • BLOG
  • [email protected]
  • (+91) 44-49521562
Merfantz - Salesforce Solutions for SMEs
Merfantz - Salesforce Solutions for SMEs
  • WHO WE ARE
  • WHAT WE DO
    • Salesforce
      • Implementations
        • Sales Cloud
        • Service Cloud
        • CPQ
        • Field Service Lightning
        • Field Service for SMEs
      • Developments
        • Salesforce Customization
        • Custom Application Development
        • AppExchange Product Development
      • Migrations
        • Classic to Lightning Migration
        • Other Systems to Salesforce Migration
      • Integrations
    • Data Science
      • BI Solutions
      • AI/ML solutions
      • Agentic AI
  • HOW WE DO
    • Delivery Model
    • Our Works
  • REACH US
    • Contact Us
    • Careers
  • BLOG

Dynamically Remove Table Column Based on Header Name in Salesforce

  • August 1, 2017
  • Merfantz Editor
  • Salesforce Developments Tutorial
  • 0

We provide you the solution for to remove some column values from a list of table rows and columns. How is it possible? We need to get column header name then you can remove.

Try the below code :-

<link rel=”stylesheet” href=”https://code.jquery.com/ui/1.11.4/themes/swanky-purse/jquery-ui.css”/>

<script src=”//code.jquery.com/jquery-1.12.4.js”></script>

<script src=”//code.jquery.com/ui/1.12.1/jquery-ui.js”></script>

<form id=”pg”>

</form>

<script>

$(‘<div id=”main” style=”float:left;width:20%;height:50%;”></div>’).appendTo(‘#pg’);

$(‘<table id=”tbl” style=”width:20%;height:20%;”><tr><th>Name</th><th>Title</th><th>Status</th><th>Date</th></tr><tr><td>Sh</td><td>Sample</td><td>Completed</td><td>12345</td></tr><tr><td>Vijay</td><td>Test</td><td>InProgress</td><td>6789</td></tr><tr><td>Meenu</td><td>Agenta</td><td>Pending</td><td>54747</td></tr></table>’).appendTo(‘#main’);

$(‘td’).css(‘border’,’3px solid #ccc’);

$(‘th’).css(‘border’,’3px solid #ccc’);

$(‘<br/><input type=”text” id=”tt” name=”txt”>’).appendTo(‘#main’);

$(‘<br/><br/><input type=”button” name=”Delete” value=”Delete” id=”btt”>’).appendTo(‘#main’);

$(‘#btt’).click(function(){

var a= $(‘input[name=”txt”]’).val();

alert(a);

display(a);

});

function display(sample){

var t = $(“th:contains(“+sample+”)”).index()+1;

if(t!=1){

$(‘th:nth-child(‘ + t + ‘)’).hide();

$(‘td:nth-child(‘ + t + ‘)’).hide();

}

else{

$(‘#tbl td:first-child’).hide();

$(‘#tbl th:first-child’).hide();

}

}

</script>

Result :-

This is the starting page view

Enter header name on text box, in which column you need to remove,

Click ‘Delete‘ button.

Title has removed on the below table view

We are the ISV Partners and Please reach us for custom development => www.merfantz.com

———————- We hope it will help to you ———————–

Author Bio

Merfantz Editor
+ Recent Posts
  • August 4, 2023
    How to Setup CRM Analytics for Financial Services Cloud
  • August 2, 2023
    How to Get Started with Salesforce Hyperforce - Merfantz
  • July 28, 2023
    Health Cloud Mastery: Salesforce Trailhead for Effective Healthcare CRM
  • July 26, 2023
    How to integrate Data cloud and Marketing cloud In Salesforce
Tags: Field Service ManagementFieldax
  • Previous How to Change Pagination View Dynamically Using Visualforce Page in Salesforce
  • Next Updating Information on Contact After a Lead is Converted in Salesforce

Leave a Reply

You must be logged in to post a comment.

Merfantz Technologies is a leading Salesforce consulting firm dedicated to helping small and medium enterprises transform their operations and achieve their goals through the use of the Salesforce platform. Contact us today to learn more about our services and how we can help your business thrive.

Discover More

Terms and Conditions
Privacy Policy
Cancellation & Refund Policy

Contact Info

  • No 96, 2nd Floor, Greeta Tech Park, VSI Industrial Estate, Perungudi, Chennai 600 096, Tamil Nadu, INDIA
  • (+91) 44-49521562
  • [email protected]
  • 9:30 IST - 18:30 IST

Latest Posts

Mastering Attachment Compression for Salesforce Developers May 9, 2025
Salesforce API Integrations: Connect with Slack, Zoom, and Teams May 2, 2025
Guide to Streamlining Sales Success
Mastering Salesforce CPQ: A Comprehensive Guide to Streamlining Sales Success April 17, 2025

Copyright @2023 Merfantz Technologies, All rights reserved