Hello Gaurav,
You can create a Style for the Editor and add an EventSetter for the ValueChanged event in order to be notified when the value is changed.
I think in this case it would be best to wait for the change to be implemented. There are several aspects that would be difficult for you to work around. First, you don't want the Value of the editor to be changed but you do want the OriginalValue of the editor to be changed. The editor would have initialized that when it entered edit mode. Second, the end user may have typed in a partial value that is not parseable into a value so you would want the editor to keep that text the user entered and the caret/selection should remain intact.
What a coincidence! I am trying to do the exact same thing and posted a question yesterday on this forum. You should check out Stefan's answer and it may be helpful to you >> http://ko.infragistics.com/community/forums/p/80441/405781.aspx#405781
I looked at Stefan's solution and it is very "close" to what I need. You don't need to subscribe to EditModeStarting or EditModeEnding event but instead should have a callback on DataValueChanged event (you need to set DataValueChangedNotificationsActive to "True" on FieldSettings object). Within this callback you will get a reference to DataValueChangedEventArgs object as an argument which will further provide references to the Field, Record, ValueHistory (holds previous historical values of that cell) and CellValuePresenter of the cell which got changed by the external ticking source.
PseudoCode >>>>
def dataValueChangedCallBack(senderObj, e):
# make sure the cell which got changed by an external source is the one which you are editing right now
if e.CellValuePresenter and e.CellValuePresenter.IsEditable and e.CellValuePresenter.IsInEditMode: ## CASE I
e.Record.Cells[e.Field.Name] = you_need_to_set_the_value_which_was_entered_by_the_user
else: ## CASE II
e.Record.Cells[e.Field.Name] = set_the_most_recent_value_from_ValueHistory_object
CASE II should be trivial. You have to set the DataValueChangedHistoryLimit to a suitable number on the FieldSettings object. Then you can get the historical data which is in the form of a Stack. Just get the top of stack (index=0) and set that to the cell.
CASE I is tricky. We somehow need to get the value which was recently entered by the user but it has not been committed yet since the user is still in EditMode. I have spent a LOT of time today trying to find an efficient way to find this uncommitted value from within the DataValueChanged callback but have been unsuccessful so far. I did find an inefficient way though ...we can subscribe to another event - "CellChanged" and then save the value entered by user in some form of a map (Key being the field/cell object which was modified by the user and Value being the new value which he entered) temporarily which can then be used inside the DataValueChanged callback.
Perhaps Stefan or someone in Infragistics dev team can point out an efficient way to get the value from within DataValueChanged callback. That would help in solving my problem too!
Hi ktokarieva,
I've discussed this a bit with our developers and they saw it necessary to log a development issue for this. Keeping the cell value from changing while the cell remains in edit mode when the underlying data item has changed isn't something that can be done at the moment because the grid manually updates the editor's value directly after the data changes. Our engineers will need to adjust this behavior internally.
I've opened up a private case for you and linked it to the development issue so that you may be notified when a fix or other resolution is available. The case number is CAS-116516-M3Q4Z1. The development issue ID is 143570.
You can find the case here: https://ko.infragistics.com/my-account/support-activity
Hi,
I need first solution(1. Write an editor that works in the way you are expecting (not recomended)) but I have not an idea how it can be implemented.
How to distinguish that the user has entered a value into editor or value has been updated from DataContext?
Could you, please, provide an example?
Thank you.