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

(Remote) Lookup ComboBox

6 Answers 132 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 13 Apr 2014, 10:20 AM
I thought this was one of the most straightforward services offered by this component, but it comes out it is a very tough functionality, to offer.
So, to recap, what is a lookup combobox?
We have a model in input, where there is some sort of id (for example, int? IDProduct, for a table in the database where I have Products(ID, Name): it is nullable because the db field can be non-mandatory, of course).
If we are editing a new record, the value in the model is obviously missing, while if I'm editing a record, the field can or cannot have a specific value.
When showing the combo in the page, if the backing model has a value for the id, we would like to show the corresponding description of the product, otherwise the combo is void.
In each case, when we start typing in the field, after the specified number of chars, a search on the server is started to show the dropdown with the corresponding records.
We select one of the items, so fixing the whole text in the combo and recording a new value for the backing IDProduct (for example, in an observable object, or directly inside the control), and when we submit the page, we send the value to the server.
Lookup comboboxes have always existed in every good user interface library for handling db data, but, for what I could read, study, and try, it's not easily done with this component.
There are the datasource, the transport, the additionaldata, filter parameters, autobind true or false, the binding of a numeric value that becomes initially also the text shown in the combo, since there are not still values in the inner cache, and so on...
I opened tickets, and solved problems one at a time, but in each case, I fixed a problem just to open another, never closing the gap to obtain a really functioning solution.
Is there anyone who wrote some *real* code that can help me, with this problem?
I find very strange that Telerik didn't make a complete sample for this behaviour, that is *really* one of the basic, and most needed, functionalities for a component like this?
Or am I missing something really important???
Please help me, I'm tired and stuck... :-(
Andrea

6 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 16 Apr 2014, 03:18 PM
Hello Andrea,

We prepared a demo, which shows how to use a ComboBox with differed binding in Grid. The Action method setup to return data only when filter text is sent. We will upload the demo as a code library.
Let me know if something is not clear.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Andrea
Top achievements
Rank 1
answered on 01 May 2014, 12:03 PM
Sorry for answering so late...
Your solution behaves well, but I continue to think that this important behaviour should be some way 'built-in' in the control. Try to ask to the average user if she/he thinks that your code is easy to handle, to understand, to customize...
Anyway, as usual, I'm impressed by your will to satisfy user requests! (Even by a pain in the neck like me! :-))
Thanks,
Andrea Bioli
0
Andrea
Top achievements
Rank 1
answered on 02 Jul 2014, 03:14 PM
I have to come back to this thread again.
I studied your example, and it looks good for the problem it solves: still, I cannot figure out how to solve my real problem (now I can focus it!).
Following your source code,what I have is an MVVM page, where the model looks like:
var model = {... categoryid: 2, categoryname: 'Condiments' ...}
I build the observable, and I bind it.
What I would like to have is a free combobox (not tied to a grid, for example), where I see the string 'Condiments' as the text currently selected (and the corresponding id, if the user doesn't modify it before submitting the model): the user is now free to look for a new category, filtering the request typing a few chars, selecting a new one, and submitting the model, where in the field categoryid (of the model, not of the combobox) I can find the newly selected category.
Starting from your code, I couldn't realize this behaviour...
Any hint?
Thanks as always...
Andrea Bioli
0
Andrea
Top achievements
Rank 1
answered on 02 Jul 2014, 03:15 PM
...and ehm...
this is what I call a 'lookup combobox': the most useful component you can give to your customers... it is needed many times in all sort of application, isn'it? ;-)
Andrea Bioli
0
Accepted
Georgi Krustev
Telerik team
answered on 04 Jul 2014, 11:45 AM
Hello,

I believe that this question is not directly related to the previous one - grid editing and combobox widget as an editor template. I would suggest you continue our discussion in the support thread that you opened regarding the new question.

I will close this thread for now.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Andrea
Top achievements
Rank 1
answered on 04 Jul 2014, 12:03 PM
Yes, I'm making a lot of confusion, I'm really aware of this... :-)
Andrea Bioli
Tags
ComboBox
Asked by
Andrea
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Andrea
Top achievements
Rank 1
Share this question
or