I created this example to show problem that occurs in my real application.
This is my source code:
When I want add new row I type something in cell and I press ENTER but new row is not added. Cell is cleared.
If I don`t use custom editor (comment out code in EditorRequired handler) on ENTER pressed new row is added with typed value.
How to solve this issue when I use custom editor?
29 Answers, 1 is accepted
Are you wanting auto complete on the add new row section? The sample below just shows a simple implementation of using a drop down column. The values will appear in a drop down in the add new row. Is this what you want to do? If you could let me know any changes you want to make, I'll do my best to help
Hope that helps
It doesn`t solve my problem.
- I cannot use column
GridViewComboBoxColumnbecause I need drop down control only in some rows.
- In your code (with EditorRequired handler) source for RadDropDownListEditorElement is list with cities. Object city has id and name – if I type something that is not in this list and I press enter cell is cleared.
In my case source is just list with strings and I want have possibility typing also something new that is not in the list. Good example is filed in web browser where you type www address – you can type something new or selected address from drop down list.
Please can you try the following
Hope that helps
It is almost perfect but there is one issue.
If I select some cell in column city and I expand list 2, 3 times I am not able to expand list more times.
When I click button with arrow down list is expanded but immediately collapsed – don’t change selected cell during these clicks to see this problem.
Yes, I see now that this is an issue. I'll look into it. Perhaps there is something I've done wrong. I'll try and get back to you as soon as I can
ok, this should be fine now. Replace the CustomEditor that I gave you before with this one.
Hope that helps
It did not help.
I still have the same problem.
If I click couple times on button with arrow down (on the same cell) list is expanded and collapsed immediately.
Ok, my fault, we didn't need the custom editor. Please can you try the following. I'm pretty confident that this is fine now, but any issues let me know
Ok problem with immediately collapsing list is resolved but we returned to my first issue.
When I type something that is not in the list and I press enter value in cell is changed to value from list, in the result typed value that is not in the list is canceled.
There is also another issue: if you click couple times in different cells from column city after some click text in clicked cell will be changed to empty.
Please can you try this. I'm rather busy at the moment so the amount of time I can spend on it is limited, but if you let me know how that is, i'll spend some more on it this evening if needs be
This is better but not enough good to use it in my real application.
There are two problems:
- If you type something new in city cell (for existing row) and press enter text in cell is ok but if you again click on the same cell to change text after switching to edit mode text in cell is cleared.
- If I want add new row I fill Id, Name and City (I type something that is not on the list) but after adding row city in added row is empty.
Thanks for help – I was trying to figure out something but I failed.
It is very annoying that it is so difficult implement so simple feature using telerik control.
This now seems to work for me. I'll also post a video in case I've missed anything. To be honest, there is likely to be an easier way that I have missed, but if it helps you, I'm happy to give it a go.
Video to follow
I added this line in handler of CellEditorInitialized:
and in your code there was missing handler for EditorRequired, probably you just forgot copy it.
There is only I think the last small issue.
Sometimes when I type something that starts from characters that match to items in the list I don`t see hint (list) with matching items. This is random I think. Do you see this problem also in you app?
I marked this as answer because it is almost perfect and you helped me a lot.
Yes, I just missed out an event handler when I pasted this in I think. I'm really glad that this has helped you. To be honest, I've tried this now quite a few times and I haven't seen the autocomplete behavior not working. Perhaps it would be good to try it with an ordinary RadDropDown list to see if it does it there too.
If there's anything else, just let me know.
Thanks. All the best
I found new problem in DropDown style.
I cannot use arrows buttons left and right to move cursorL
Do you have any ideas?
Hope you're well. I'm not quite sure what you mean. I have recorded a quick video based on the code that I gave you that you marked as answer above. As you can see, as I move between cells and up and down, I used the keyboard all the time.
The video can be found here
Thanks I am fine, I hope you also.
Your video does not show my problem.
Let say that I have text: abcdefg
I want set text cursor (small vertical line) between ‘c’ and ‘d’. I want do it using keyboard buttons: arrow left or arrow right.
I see. I'll see if I can find a way to get that to work in the desired way.
It would be great if you found some fix.
I missed this problem and it is already in my application – QA found this bug during testing.
I've just tried this on a normal situation GridViewComboBoxColumn set to and it seems that this is the default and normal current behaviour. As I said though, I'll see if I can find a way to achieve what you need
I have checked sample from telerik demo: DropDown&List -> DropDownList -> AutoComplete (example with countries).
In this example you can use keys arrow left and arrow right to move cursor without any problems.
I think current behavior for GridViewComboBoxColumn in
DropDown/AutoComplete mode is not desired – in my opinion it is bug.
Yes, I see that it works as you'd expect if it's just a RadDropDownList. I'm not sure at the moment if how it is behaving in a GridViewComboBoxColumn is expected, but I tend to agree. It's not right that the left and right arrows don't work at all (they work as you'd expect in a GridViewTextBoxColumn. I'll keep looking. I'm sure this can't be too difficult but I haven't got there with it yet.
The RadDropDownListEditor behavior described by you is the intended one. This editor is usually used to select an option from a list and this navigation is convenient for this scenario.
You can accomplish your task by creating a custom editor as in the following code snippet:
I hope it helps.
the Telerik team
thanks a lot