Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1150
igCombo inside igGrid displays ValueKey instead of TextKey when edit mode ended
posted

Hi,

I have another question on having igCombo as editor inside an igGrid. I set up my editor something like this:

features.Updating()
  .EnableAddRow(true)
  .EnableDeleteRow(true)
  .EditMode(GridEditMode.Row)

  .ColumnSettings(s =>

{

      s.ColumnSetting().ColumnKey("Product").EditorType(ColumnEditorType.Combo)
          .ComboEditorOptions(options => { options.DataSource(Model.Products).TextKey("ProductName").ValueKey("ProductID"); });

}

When I select a product from the combo, the ProductName is displayed, but when I clicked the 'Done' button, the ProductID is displayed instead of the ProductName.

Is this the intended behavior ? if so, is there any way around it ? I want to display the text value after the edit mode ended.

Also, why is the combo data source not getting the whole object that I passed in from the MVC controller ? let's say my Product entity has ID, Name, Price, and Description. Only the Name and ID are available inside the data source since it's set as Text and Key value.

Thanks,

Jeffrey

Parents
No Data
Reply
  • 23953
    Suggested Answer
    Offline posted

    Hi Jeffrey,

    The behavior is correct, because at the end the igCombo.options.valueKey is what it gets to the underlying data source and that value is displayed in the cell. You can workaround it as I described in this forum thread:

    http://ko.infragistics.com/community/forums/p/72892/370474.aspx#370474

     

    jAndika said:
     

    Also, why is the combo data source not getting the whole object that I passed in from the MVC controller ? let's say my Product entity has ID, Name, Price, and Description. Only the Name and ID are available inside the data source since it's set as Text and Key value.

    I don't know the exact reason, but I guess this is done to save network traffic. textKey and valueKey properties are all that igCombo is needing to do its job and thus the data source is stripped to these two properties.

     

    Best regards,

    Martin Pavlov

    Infragistics, Inc.

Children