This is a migrated thread and some comments may be shown as answers.

DropdownHtmlAttribute migratin for Kendo combobox

4 Answers 48 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Achilles
Top achievements
Rank 1
Achilles asked on 25 Jun 2013, 05:34 AM
Hi,

I am migrating my application from MVC Extensions to Kendo. I have a Combobox whose width (in the closed state) is 250px. But when it is open, the width of the dropdown is 400px. Please have a look at the attached screenshot.
I achieve it with something like

@(Html.Telerik().ComboBox().Name("CbPlants")
        ...
        ...
       .HtmlAttributes(new { style = "z-index: 20; width: 250px;" })
       .DropDownHtmlAttributes(new { style = "width: 400px;" })       
       )
       

  When I migrate it to Kendo, I couldn't find an equivalent to have a DropDownHtmlAttributes for customizing the width. Any idea how I can achieve this effect ?

Thanks & Regards

Achilles

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 26 Jun 2013, 04:16 PM
Hi Achilles,

Width of ComboBox' drop-down list can be changed via jQuery width method. For example:
@(Html.Kendo().ComboBox()
      .Name("customers")
      .DataTextField("ContactName")
      .DataValueField("CustomerID")
      .HtmlAttributes(new { style = "width: 400px" })
      .DataSource(source =>
      {
          source.Read(read =>
          {
              read.Action("GetCustomers", "Home");
          });
      })
)
<script>
    $(function () {
        $("#customers").data("kendoComboBox").list.width(600);
    });
</script>

For more information please check this help topic:

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Accepted
Achilles
Top achievements
Rank 1
answered on 27 Jun 2013, 05:13 AM
Hi Alexander,

It worked. Thanks

Regards

Achilles
0
Tony
Top achievements
Rank 1
answered on 10 Oct 2013, 12:17 AM
Is there any plan to support this with the Kendo MVC Extensions? (ie. no longer required to write the additional javascript to resize the list)

Thanks,
Tony
0
Alexander Valchev
Telerik team
answered on 10 Oct 2013, 07:20 AM
Hello Tony,

Currently widgets does not have a configuration option that allows the developer to set the width of the widget's Popup List, which is why there is no way to set this using MVC wrappers only.
If you would like to see such feature added in one of our next releases, my recommendation is to submit a feature request at Kendo UI Feedback portal. In this way we will be able to track the community interest in it. If it turns out to be popular we will consider it.

Regards,
Alexander Valchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ComboBox
Asked by
Achilles
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Achilles
Top achievements
Rank 1
Tony
Top achievements
Rank 1
Share this question
or