TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
Hability to Collapse/Expand Grouped Records in Views
Grouping records in views is very usefull
It would be great if you also have de hability to collapse or expand those grouped records

Thanks Expanded grouped records in a view.pdf
ID
1322
Category
TeamDesk
Author

Rafael Muñiz
Date Created
12/4/2019 11:26:18 AM
Date Updated
11/27/2024 6:52:17 AM
Status
New Idea
Score
100
Promoted By
Jorge SoláMonica KMYCS Support
Jacques du PlessisSilke BögeleinAdmin Account
Anatoliy ZachynskiyPhilipp Matuschka (MMB)Patricio Bustos
Rafael Muñiz
Comments
Patricio Bustos 12/4/2019 11:35:34 AM
It would be useful on views or dashboard as well
Tks!
Philipp Matuschka (MMB) 12/5/2019 5:08:49 AM
And x-tabs.
And subotals in x-tabs. Please!!!!!
Admin Account 6/17/2020 9:26:45 PM
This would be such a game changer for TeamDesk. I really hope they are able to implement this feature.
Jorge Solá 11/27/2024 6:22:36 AM
Here is a script to ensure that grouped record rows in grouped views are initially collapsed. When the small triangle by the group header is clicked, it toggles the visibility of the corresponding group of rows. To enable it, simply add it to your dbscript.js file in Resources:

// Function to apply the toggle behavior to group headers
function applyGroupHeaderToggle(container) {
// Select all group header rows within the specified container
const groupHeaders = container.querySelectorAll('.v3-tableview-grouphead');

groupHeaders.forEach(header => {
// Check if the triangle toggle already exists to avoid duplicates
const headerLeftCol = header.querySelector('.v3-tableview-grouphead__col-left');
if (headerLeftCol && !headerLeftCol.querySelector('.toggle-icon')) {
// Create a small triangle to prepend to the header's left column
const toggleIcon = document.createElement('span');
toggleIcon.textContent = "▶"; // Collapsed state icon
toggleIcon.className = "toggle-icon"; // Add a class to identify the icon
toggleIcon.style.cursor = "pointer";
toggleIcon.style.marginRight = "8px";

// Initially collapse the group rows
const groupRows = header.nextElementSibling;
if (groupRows && groupRows.classList.contains('v3-tableview-group')) {
groupRows.style.display = "none"; // Hide group rows by default
}

// Prepend the triangle icon to the left column of the header
headerLeftCol.prepend(toggleIcon);

// Add click event listener to toggle visibility of group rows
toggleIcon.addEventListener('click', function () {
if (groupRows && groupRows.classList.contains('v3-tableview-group')) {
if (groupRows.style.display === "none") {
// Expand the group
groupRows.style.display = "";
toggleIcon.textContent = "▼"; // Expanded state icon
} else {
// Collapse the group
groupRows.style.display = "none";
toggleIcon.textContent = "▶"; // Collapsed state icon
}
}
});
}
});
}

// Initial application of the toggle behavior to the entire document
document.addEventListener("DOMContentLoaded", function () {
applyGroupHeaderToggle(document);

// Set up a MutationObserver to watch for dynamically added content
const observer = new MutationObserver(mutations => {
mutations.forEach(mutation => {
// Check for added nodes
mutation.addedNodes.forEach(node => {
if (node.nodeType === 1) { // Ensure it's an element node
// Apply the toggle behavior to the new content
applyGroupHeaderToggle(node);
}
});
});
});

// Observe changes in the body for added nodes
observer.observe(document.body, {
childList: true,
subtree: true
});
});

If you are using the new UI, you can add the same script to your dbscript-v3.js file.

Enjoy!
Rafael Muñiz 11/27/2024 6:52:17 AM
Excellent Jorge, Buenísimooo!!
This should be an option when customizing views with grouping
Thanks a lot!!!
Feedback
 
Back to Search Results