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

How to set combobox dropdown width with angular?

4 Answers 445 Views
Integration with other JS libraries
This is a migrated thread and some comments may be shown as answers.
Boris
Top achievements
Rank 1
Boris asked on 25 May 2016, 02:23 PM
I need to specify the width of the dropdown. Is there a way to do this in angular?

4 Answers, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 26 May 2016, 09:07 PM
Hi Boris,

Currently, there is no angular solution for setting the width of the ComboBox Dropdown list.  However, you can set it during the kendoWidgetCreated event using jQuery.  You can see the implementation in this Kendo UI Dojo by Progress.

Here is the function:
$scope.$on("kendoWidgetCreated", function(event, widget) {
        if (widget === $scope.localCombo){
          widget.list.width(400);
        }
        if (widget === $scope.remoteCombo){
          widget.list.width(200);
        }
      });

Also, please check out our Kendo Feedback Portal to request new features.

Hope this helps!

Regards,
Patrick
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Boris
Top achievements
Rank 1
answered on 15 Jun 2016, 01:56 PM
Unfortunately this did not work.
0
Boris
Top achievements
Rank 1
answered on 15 Jun 2016, 02:09 PM

The reason I think it's not working for me is because my comboboxes are inside an ng-repeat.

Is there a solution in this case?

0
Accepted
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 15 Jun 2016, 09:14 PM
Hello Boris,

Here are a couple approaches you can use to set your Kendo ComboBoxes list widths.

1.  Using widget.ns:

On the kendoWidgetCreated event, I checked the widget to see if it was a comboBox:
$scope.$on("kendoWidgetCreated", function(event, widget) {
  if (widget.ns === ".kendoComboBox"){
    widget.list.width(200);
  }
});

2. Using the object from ng-repeat:

On the kendoWidgetCreated event, I checked the item name from myObj used by ng-repeat:
<div ng-repeat="item in myObj">
 ...
</div>
<script>
...
$scope.myObj = [
   {"name":"a"}, {"name":"b"}, {"name": "c"}
];

$scope.$on("kendoWidgetCreated", function(event, widget) {    
    if (widget.$angular_scope.item.name === "a"){
      widget.list.width(200);
    }
    if (widget.$angular_scope.item.name === "b"){
      widget.list.width(400);
    }
    if (widget.$angular_scope.item.name === "c"){
      widget.list.width(600);
    }
});
...
</script>       

Hope this helps! 

Regards,
Patrick
Telerik
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
Tags
Integration with other JS libraries
Asked by
Boris
Top achievements
Rank 1
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Boris
Top achievements
Rank 1
Share this question
or