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

DropDownList mapping text and value to columns/properties in the Grid

7 Answers 193 Views
Grid
This is a migrated thread and some comments may be shown as answers.
CS
Top achievements
Rank 2
CS asked on 18 Jun 2014, 07:30 AM
I get the content of the DropDownList from a remote datasource. The received data looks different from the schema I have so I need to get the connection between the object of the column I'm in and the results from the request plus I need to bind that correctly that the text and value are correct in the cell but not with the original property names.

7 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 20 Jun 2014, 07:09 AM
Hi Stefan,

Could you please provide the following additional information in order to get better overview of the exact setup that you have:

- example response that is returned from the server to the DropDownList
- example objects (data) from the Grid DataSource
- desired result after choosing value in the DropDownList (above object with the related property set)
- the current Grid code that you are using

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
CS
Top achievements
Rank 2
answered on 20 Jun 2014, 07:49 AM
It is really hard to replicate the stuff outside of my current working environement. I can't even make the dropdown work properly without any debugging options :( It would look somewhat similar to this.

example
0
CS
Top achievements
Rank 2
answered on 20 Jun 2014, 08:00 AM
I fixed the example but I have no idea how to output the necessary values. The dropdown will return "Text" and "Value" but I would need those in "formattedValue" and "value".
0
Accepted
Vladimir Iliev
Telerik team
answered on 24 Jun 2014, 07:27 AM
Hi Stefan,

After reviewing the provided demo it seems that you should fix the following issues:
  • Remove the "Category_formattedValue" and "Category_value" fields from the model
  • Modify the "Category" column template as follows:
    template: "#=Category ? Category.formattedValue : ''#"
  • Define "schema" for the dropDownList dataSource in order to make the items have the same propertied as "Category" field in the grid dataSource:
    schema: {
      model: {
        fields: {
          formattedValue: {from: "Text"},
          value: {from: "Value"}
        }
      }
    }
After the above changes the demo start working as expected on our side - please check it below:
Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
CS
Top achievements
Rank 2
answered on 24 Jun 2014, 02:12 PM
The demo works. I made the changes in my project and it absolutly does not work, I only get entries of "undefined" in my case.
0
CS
Top achievements
Rank 2
answered on 24 Jun 2014, 02:15 PM
Is there a way to inspect/debug a dropdownlist in the way of pausing when the object is send to the select box just to see what got sent there and what was expected? Because it looks a bit like the mapping is not working correctly but I have no way to jump into the schema and verify that assumption.
0
CS
Top achievements
Rank 2
answered on 24 Jun 2014, 02:36 PM
Okay it now works, my schema slipped in the transport and caused that problem.
Tags
Grid
Asked by
CS
Top achievements
Rank 2
Answers by
Vladimir Iliev
Telerik team
CS
Top achievements
Rank 2
Share this question
or