[DevExpress Support Team: CLONED FROM T213672: Issue with Repository LookupEdit when using PostEditor]
GridControl - RepositoryLookUpEdit loses its value if the PostEditor method is called in the EditValueChanged event handler
Answers approved by DevExpress Support
We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.
Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.
- v15.2.4Download Official Update
- v15.1.8Download Official Update
Hi,
We investigated this problem and come to the conclusion that it is incorrect to call the GridView.PostEditor method in the RepositoryLookUpEdit.EditValueChanged event handler. Previously, it worked for your scenario. However, if you had tried to remove a typed text and typed it again, nothing would have worked as I showed in my video recorded by using version 13.2.
If it is vital for you to save changed values to a data source when an editor is active, either use the approach suggested by me in the Issue with RepositoryLookUpEdit when using PostEditor thread or call the GridView.PostEditor method after closing a popup window in the RepositoryItemLookUpEdit.Closed event handler.
UPDATED:
It appears that I found a simpler solution that will meet your requirements. Now, the text disappears since a grid cell is refreshed when you post changes to the data source. I suggest that you update the data at the data source level, not by using the grid's methods.
Try the following approach:
C#private void repositoryItemLookUpEdit1_EditValueChanged(object sender, EventArgs e)
{
LookUpEdit edit = sender as LookUpEdit;
DataView dt = gridView2.DataSource as DataView;
int index = gridView2.GetDataSourceRowIndex(gridView2.FocusedRowHandle);
dt[index][gridView2.FocusedColumn.FieldName] = edit.EditValue;
}
I tested out both solutions, and neither seem to replicate the behavior we want.
The first (the BeginInvoke option) will select the first state that matches in the list. So if we have IA, and then IL, it is impossible for a user to select IL, as every 'I' keystroke will select IA. Typing I and then L, will select IA, and then select LA, as it's hitting the post editor every keystroke. I've attached a video that shows this.
The second option requires their user to confirm their choice by hitting enter, which in our data-entry heavy application, is just another step they are not used to. The idea is to let them type it and not have to confirm it.
Any ideas?
Hi,
It appears that I found a simpler solution that will meet your requirements. Now, the text disappears since a grid cell is refreshed when you post changes to the data source. I suggest that you update the data at the data source level, not by using the grid's methods.
Try the following approach:
C#private void repositoryItemLookUpEdit1_EditValueChanged(object sender, EventArgs e)
{
LookUpEdit edit = sender as LookUpEdit;
DataView dt = gridView2.DataSource as DataView;
int index = gridView2.GetDataSourceRowIndex(gridView2.FocusedRowHandle);
dt[index][gridView2.FocusedColumn.FieldName] = edit.EditValue;
}
Once you test it, let me know your results.