Ag-grid's column menu option: show excessive text in overflow menu

Ag-grid's default behavior is to set a fixed column menu width, but their documentation provides an example of how to change it to a different fixed value. However, the drawback of this method is that all columns end up with the same menu width.

Is there a way to dynamically adjust the column menu width based on the filter list values for each column? Unfortunately, trying to set a dynamic width using the following CSS rule has no effect:

.ag-set-filter-list {
  width: auto;
}

Another potential solution could be word wrapping, but attempting to implement it with the following CSS rule also does not work:

.ag-set-filter-list {
  overflow-wrap: break-word;
}

I even attempted to use the postPopup callback to adjust styling after rendering, but unfortunately, it was unsuccessful:

created() {
  this.postProcessPopup = (params) => {
    if (params.type !== 'columnMenu') {
      return;
    }
    params.ePopup.style.overflowWrap = "break-word";
    params.ePopup.style.width = "auto";
  }
}

Answer №1

Exploring further into Ag-grid's filter list styling, it became apparent to me that the filter items are positioned absolutely and utilize the top values for their placement. This created challenges in wrapping filter values without causing them to overlap.

After reaching out to Ag-grid support, I was informed that dynamic filter list widths are not supported. However, they did highlight their tooltips feature, which proved to be suitable for my specific scenario.

I decided to customize this feature by implementing two modifications:

  1. Display tooltips only for filter list values that exceed a certain length and risk being truncated at the edge of the filter menu.
  2. Show tooltips exclusively for values within the filter list, omitting tooltips for rows in the grid.

Below is my version of a custom tooltip with the aforementioned adjustments:

export class GridColumnFilterTooltip {
  init(params) {
    const FILTER_VALUE_CHARACTER_LIMIT = 28;
    this.tooltip = document.createElement("div");

    if (
      params.location === "setFilterValue" &&
      params.value.length > FILTER_VALUE_CHARACTER_LIMIT
    ) {
      this.tooltip.classList.add("grid-column-filter-tooltip");
      this.tooltip.innerHTML = params.value;
    }
  }

  getGui() {
    return this.tooltip;
  }
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can one utilize the this.$q Quasar object within the setup() function in Vue 3 Composition API?

Here is a component script written in Options Api: <script> export default { data() { return { model: null, }; }, computed: { isMobile() { return this.$q.screen.xs || this.$q.screen.sm; } } }; </script> If y ...

Guide to applying filter criteria on the v-select module in Vuetify

Is it possible to set a condition in v-select to display only specific options? For example: <div id="app"> <v-app id="inspire"> <v-container fluid grid-list-xl> <v-layout wrap align-center> <v-flex xs12 sm6 ...

How can I retrieve the reference number of an item by clicking a button within a list item in an unordered

Presented here is a collection of data points and a button nested within an ul <ul> <li class="mix" category-1="" data-value="600.35" style="display:block;"> <figure> <figcaption> <h3> ...

You can activate Lightgallery just one time in VueJs

I am facing an issue where lightgallery can only be opened once. Subsequent clicks on the button are unresponsive. The lightgallery is being used as a component. Within my parent component, I have two buttons for opening image or video gallery ParentComp ...

Tally the quantity of data points within jQuery Datatables

Upon navigating to my jQuery DataTable, I aim to showcase the count of Users pending activation. Typically, I would use fnGetData with (this), but since I am not triggering this on a click event and wish to count all entries in the table, I am unsure of ho ...

I am having trouble displaying all the div elements with the same #id simultaneously

Click here for the code snippet The code provided seems to have a problem where hello2 and hello3 are not displaying. Is this issue related to the fact that '#id can only be used once'? Making it a class does not seem to work either. How can thi ...

I'm currently working on developing a CPS tester, but have encountered a few challenges along the way

All of the text remains aligned to the left, despite my attempts to position it at the top. I feel like I haven't even completed 1% of the task and I'm faced with countless issues. Although I've coded it so that every click should incremen ...

Ways to implement multi-file loading on a website using separate HTML segments

Currently, I am working on a website for my local community. Each page contains similar content like header, navigation bar, and footer. I want to streamline this process by storing these common elements as separate HTML files. Is it possible to link the ...

Unable to show inline within web forms application utilizing bootstrap

I am currently modifying the account registration section of a new VS 2013 web application that uses bootstrap css for formatting. I am working on creating a form on a page and struggling to get one section to display inline instead of as a block element. ...

Simultaneous movements within a Vue.js collapsible panel

Struggling with a Vue.JS accordion that has transitions to collapse and expand the sub menus? The issue is that Vue seems to wait for one transition to finish before starting the next, even though all transitions are applied at the same time. Specifically ...

How to align the navbar toggle button and list items to the right in Bootstrap 5

I'm struggling with a simple html page that has a fixed navbar at the top. Everything looks great when viewed in full-screen mode, with centered links. However, when the page size is reduced, it collapses to a toggle button on the left side. What I re ...

Can CSS content be used to showcase an .html document or .html fragment?

Referencing the MDN documentation for css content: /* <uri> value */ content: url(http://www.example.com/test.html); Inquiry: Can an image be displayed using the url() value of the content property in a css html element? .content { conte ...

Prevent event bubbling in jQuery when interacting with an accordion header

I have been attempting to make a checkbox function correctly within an accordion header (including the click event). I came across an example using an older version of jquery (version 1.6.3) at http://jsfiddle.net/CkL2r/1/ or you can view the code below; ...

What is the best way to incorporate CSS background-color into a PHP echo statement for added style

Can you help me with this issue? I'm trying to set a background color for a PHP echo statement. This is my current script: <div class="container"> <input name='kursi[]' value='A1' id='A1' onclick=& ...

Issue with IE11: Flexbox with absolute positioning not sizing correctly, fills entire width instead of individual content

Here's a simple case to reproduce the issue: <div style="display: inline-block; position: relative; border: 1px solid black;"> short <div style="display: flex; position: absolute; border: 1px solid black; top: 100%; lef ...

Using jQuery and JSON data to dynamically populate a second dropdown menu with filtered options

I am working on a form with two drop-down menus and a text box. The first drop-down contains static values, while the second drop-down is populated dynamically from a JSON array. My goal is to filter the options in the second drop-down based on the selecti ...

What is the best way to create a list from a matrix using JavaScript?

I have an array structured as follows: const input_array= [ ["red", "green"], ["small", "medium"], ["x", "y", "z"] //... can have any number of rows added dynamically ...

Tips for connecting two separate Vue.js applications

Take note: this is the rid function that is called within the code. <script> const rid = () => "rid_" + Array.from(crypto.getRandomValues(new BigUint64Array(2))).map(item => item.toString(36)).join(""); </script&g ...

Placing pins on Google Maps

I'm attempting to display two separate markers on two individual maps positioned next to each other on my website. <script type="text/javascript"> var map, map2; function initialize(condition) { // setting up the maps var myOptions = { zoo ...

Position the search bar section in the center of the header using bootstrap 4

I am attempting to center a div with a search bar. I experimented by using position: absolute on the main div along with position: relative, but it did not yield the desired result. The search bar should be positioned below the text. I created this using B ...