-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI Grid dropdown empty space item display #3942
Comments
@Kranthikumar2555 , i have tried your suggestion with below steps, but it does not help. Please tell me what i am doing wrong here. below is the html div which renders the ui grid. <div ui-grid="gridOptions" ui-grid-edit class="grid"></div> i have added style as below. |
You need to set the id of the dom element you are using the directive on. In your case:
With the style:
Lookup how CSS selectors work in order to understand how |
@JLLeitschuh , i created sample plunker and did the same above approach. Still issue was not resolved. Please see the plunker http://plnkr.co/edit/vhAATILeLpfd2CJONKi6?p=preview In this plunker page the "Gender" column dropdown has empty space item. |
The blank value will be removed when you chose one of the options. AngularJS adds this blank option when your model value is not in the options for the drop down list. If you want it to default to a value, you should set that on the object that is bound to that row in your grid. |
@bernhard-hofmann , so is it not possible to remove that blank option without setting to any default value (or) choose one of the options ? |
If there wasn't a blank, which value would you expect to be selected? The DDL (Drop Down List) will show the selected item when the list is not shown, so what you see there must be in the list. AngularJS doesn't make an assumption on your default, so it inserts a blank (to match your model). Once you select one of the options, the blank is no longer needed and removed for you. |
@bernhard-hofmann Should the above also apply if the choice was already set in the data? I see blank value as an option, even though my data has a value set. Is this because I am binding to object rather than ID ("field" prop of the columnDef points to an object). Is there some "track by" I can use to indicate what option is already selected in the data (such as with ng-options)? |
Often the trick is 1 v's "1" in your data. i.e. string v's numeric. |
Thanks for the confirmation I should be able to bind to an object, display it's "name" prop and not have a "blank" dropdown option. I confirmed both my original data in the grid as well as the data in I thought maybe the blank option appeared because I assigned the dropdown values after async call, but I see the blank option even when I hardcode the dropdown options. Here I created a plunk, showing the blank option still appears, even when the data is already set to an identical option that appears in the |
@ArunMNew .filter('mapGender', function() { editDropdownOptionsArray: [ |
@JLLeitschuh had it right, try checking on the console which value is getting the option, since maybe it's "?" instead of "". |
I want to hide one specific value from editDropdownOptionsArray on the basis of some condition?? |
What was the fix for this issue ? Facing similar defect. |
I had the same issue (a blank item showing upon clicking the UI cell. The issue was due to the cell value not being within the defined/included editDropdownOptionsArray. |
I figured it out! The css that @JLLeitschuh posted is correct but the first-child value needs to be changed from "" to "?". So this: Needs to become: The blank value should no longer be displayed. |
I added those code , but the issue still not fix. Can you help me. |
What finally worked for me is:- |
Hi,
In UI Grid when i use "'ui-grid/dropdownEditor" editableCellTemplate for display the dropdown
by default it shows an extra empty space item as first index along with actual itemsource.
I want to load actual itemsource without any selected item ...
Is there anyway to remove/hide that empty space item ?
The text was updated successfully, but these errors were encountered: