Skip to content
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

SelectedValue of a SelectList inside a DataGrid's EditTemplate strange behavior #293

Closed
hybrid2102 opened this issue Oct 2, 2019 · 3 comments
Labels
Status: Investigate Needs to investigate more to what can be done. Type: Bug 🐞 Something isn't working
Projects
Milestone

Comments

@hybrid2102
Copy link

When I'm editing a DataGrid row, using a custom EditTemplate with a SelectList, with it's SelectedValue binded to CellEditContext.CellValue, the SelectedValue displayed doesn't change.

@hybrid2102 hybrid2102 changed the title SelectedValue of a SelectList inside a DataGrid's EditTemplate strange behaviour SelectedValue of a SelectList inside a DataGrid's EditTemplate strange behavior Oct 2, 2019
@hybrid2102
Copy link
Author

@stsrki stsrki added Type: Bug 🐞 Something isn't working Status: Investigate Needs to investigate more to what can be done. labels Oct 2, 2019
@hybrid2102
Copy link
Author

updated the demo, push missed :-P

@stsrki stsrki added this to the 0.8.8 milestone Nov 29, 2019
@stsrki stsrki added this to Backlog in Development via automation Nov 30, 2019
@stsrki stsrki moved this from Backlog to To do in Development Nov 30, 2019
@stsrki stsrki moved this from To do to In progress in Development Dec 27, 2019
@stsrki
Copy link
Collaborator

stsrki commented Dec 27, 2019

Hi @hybrid2102

Sorry it took so long to get to this. I tried your example and to make it work you just had to set the context.CellValue

Example:

<SelectList Data="@allBrands"
            TextField="@(i => i.Name)"
            ValueField="@(i => i.Id)"
            SelectedValue="@((int)((CellEditContext)context).CellValue)"
            SelectedValueChanged="@(e =>
                                    {
+                                        context.CellValue = Convert.ToInt32(e);
                                    } )" />

The reason for this is that context is used as a proxy for edited values. So you need to set it based on the changed value passed from SelectList through the SelectedValueChanged event handler

@stsrki stsrki closed this as completed Dec 27, 2019
Development automation moved this from In progress to Done Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Investigate Needs to investigate more to what can be done. Type: Bug 🐞 Something isn't working
Projects
Development
  
✔ Done
Development

No branches or pull requests

2 participants