Completed
Last Updated: 07 Jan 2022 10:29 by ADMIN
Release 3.0.0
René
Created on: 04 Nov 2020 13:52
Category: AutoComplete
Type: Feature Request
9
Remove default 300px inline width from the dropdowns (autocomplete, dropdownlist, combobox, multiselect)

Please remove the hardcoded width and make default width 100% as in the other components.

---

ADMIN EDIT

I updated the title to be more generic - it should be about removing the inline width rule, and whether there will be a default value and what units it will use will be up to a more detailed research.

---

4 comments
René
Posted on: 05 Nov 2020 08:20

Hi Marin,

thank your for your explanation.

The rule

.k-grid-edit-cell .k-autocomplete {
        width: calc(100% + 18px) !important;
    }

does the trick.

Regards,

René

ADMIN
Marin Bratanov
Posted on: 05 Nov 2020 07:39

Hi René,

There are various CSS rules in our component for integrations like this. I am attaching a screenshot that shows where that rule comes from and how it cascades through the edited row for the grid, and another one that shows the default value for a standalone textbox.

Setting the width to 100% will work in the grid too, but you need to keep in mind that the grid cells have some default padding which CSS takes into account. You could remove it for all columns in the entire grid, or you could use the CellRender event of the column to add specific classes to specific columns/cells and cascade through them (e.g., also through the edit row) to remove padding for a particular cell in particular mode.

For the dropdowns, if you want to use CSS right now, you must use the !important modifier so your rules can override the inline style.

Here's how a sample rule would look like (available in the attached sample page too):

 

    .k-grid-edit-cell .k-autocomplete {
        width: calc(100% + 18px) !important;
    }

If that inline width is removed, you'd likely be able to remove the !important modifier (you'd still have to ensure your own selector is heavier than a rule coming from our themes). If that default width is replaced with something like 100%, you'd still need the !important keyword.

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

René
Posted on: 04 Nov 2020 17:42

Hi Marin,

if components are used within an EditorTemplate in a grid, setting the width to 100% does not make them use the full available space.  If Width is removed I can see that the default Width is "calc(100% + 18px)" (and not 12.5em as stated below).  This makes them use the full available space in the column.  I want this behaviour for the autocomplete.  Setting Width of the Autocomplete component to 100% does not work since the input within the component has the fixed width of 300px.

Is there a way to fix this with a css rule for that UseCase ?

ADMIN
Marin Bratanov
Posted on: 04 Nov 2020 17:04

Hi René,

We are aware of this and, in retrospect, it might not have been the best idea to add such a default value. We do have it in our backlog to revise that, as it applies to all dropdowns (not just the autocomplete, also the dropdownlist, combo box, multiselect).

The key issue is that this may be perceived as a breaking change so we need to tread carefully and review it when the time comes to do a 3.0.0 release.

On a side note, the other inputs usually default to 12.5em, not to 100%. Making an input be 100% is either done by setting its Width parameter to 100% (which works for the dropdowns too), or by using CSS selectors (which may get complicated if you want it to target many different components and scenarios).

 

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.