This question is locked. New answers and comments are not allowed.
I have a grid with a ForeignKey column. Its a wide grid to allow for the text of the drop down.
But the drop down itself is narrow.
How can I adjust the width of the ForeignKey drop down, so I do not have multiple lines displayed in the drop down.
I know I can set the .DropDownHtmlAttributes(new { style = "width:300px" }) on a drop down list.
But how can I change it when its a ForeignKey Column?
Can the width be adjustable based on the data ? I don't want multiple lines for an item in the list.
I've attached a screen shot of the problem.
But the drop down itself is narrow.
How can I adjust the width of the ForeignKey drop down, so I do not have multiple lines displayed in the drop down.
I know I can set the .DropDownHtmlAttributes(new { style = "width:300px" }) on a drop down list.
But how can I change it when its a ForeignKey Column?
Can the width be adjustable based on the data ? I don't want multiple lines for an item in the list.
I've attached a screen shot of the problem.
6 Answers, 1 is accepted
0
Dadv
Top achievements
Rank 1
answered on 06 Apr 2012, 02:08 PM
Use the OnEdit event and jquery to add a css style (or better a new css class)
0
bbeatty
Top achievements
Rank 1
answered on 06 Apr 2012, 03:24 PM
Which object would I set the css class?
Can you supply an example?
Thanks
Can you supply an example?
Thanks
0
Accepted
Dadv
Top achievements
Rank 1
answered on 06 Apr 2012, 03:31 PM
try something like this :
function onEdit(e)
{
var row = e.row;
$(row).find('.t-dropdown').css('width','300px');
//or better : $(row).find('.t-dropdown').addClass('myClass');
}
function onEdit(e)
{
var row = e.row;
$(row).find('.t-dropdown').css('width','300px');
//or better : $(row).find('.t-dropdown').addClass('myClass');
}
0
Rajesh
Top achievements
Rank 1
answered on 09 Apr 2012, 07:08 AM
What if there are multiple foreign key columns? which item of class "t-dropdown" will be retrieved?
0
0
Rajesh
Top achievements
Rank 1
answered on 13 Apr 2012, 09:05 AM
OK, a Telerik question -
If i change the width of the t-dropdown using jquery, it also resizes the grid columns. What i want is the drop down items to not wrap around - and they are <li>s in a t-animation-container, that is not present when OnEdit fires. AFAIK, the telerik dropdown does not expose any jquery event onDropDown (or the like). So how do is set the width of the t-animation-container and/or t-popu t-group corresponding to the t-drop-down.
If i change the width of the t-dropdown using jquery, it also resizes the grid columns. What i want is the drop down items to not wrap around - and they are <li>s in a t-animation-container, that is not present when OnEdit fires. AFAIK, the telerik dropdown does not expose any jquery event onDropDown (or the like). So how do is set the width of the t-animation-container and/or t-popu t-group corresponding to the t-drop-down.