|
Note: Implement INotifyPropertyChanged to avoid update issues.
|
|
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
dataGrid.GridLoaded += DataGrid_GridLoaded;
}
public void EditCall()
{
dataGrid.CurrentCellEndEdit += DataGrid_CurrentCellEndEdit;
dataGrid.Refreshed();
}
private void DataGrid_CurrentCellEndEdit(object sender, GridCurrentCellEndEditEventArgs e)
{
var data = dataGrid.GetRowGenerator().Items.FirstOrDefault(x =>x.RowIndex == e.RowColumnIndex.RowIndex).RowData as OrderInfo;
if (data.CustomerID != null)
{
data.CustomerID = "Changed";
}
}
private void DataGrid_GridLoaded(object sender, GridLoadedEventArgs e)
{
dataGrid.BeginEdit(2, 2);
this.EditCall();
}
}
|
Hi,
i want to change the value of a cell in code and tested your example in this thread (Sample Link: http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfGrid_Sample-177656109).
I expected that when I double tap into a cell and leave it the new value text of the cell is "Changed" but the grid shows the old value.
Can you help me to solve that?
Thanks!
|
[C#]
//When the Cell is in view use this code.
var data = dataGrid.GetRowGenerator().Items.FirstOrDefault(x =>x.RowIndex == e.RowColumnIndex.RowIndex).RowData as OrderInfo;
if (data.CustomerID != null)
{
data.CustomerID = "Changed";
}
// if you want to update the cell which is not in view, you can use as below.
// It’s just enough to change the underlaying collection.
viewModel.OrderInfoCollection[5].CustomerID = "Changed";
|
Hi Maria,
Thank you for your patience.
We have checked the shared Model and ViewModel codes in that you have converted into list of items and then added those items in observable collection. Hence we have prepared the sample with the same use case but the issue is not reproduced for us. Can you please modify the below sample to reproduce the issue. To resolve the issue earlier for you.
Sample link : http://www.syncfusion.com/downloads/support/forum/135425/ze/sample-182563154
Regards,
Pradeep
Kumar b
|
[C#]
private void ChangeBezeichnung(object sender, EventArgs e)
{
viewModel.FaList[2].FaItem.ZusatzInfo = "CHANGED";
var dataRow = dgAuftraege.GetRowGenerator().Items.FirstOrDefault((x => x.RowData == viewModel.FaList[2]));
dgAuftraege.UpdateDataRow(dataRow.RowIndex);
dgAuftraege.Refresh();
} |
|
[System.Runtime.Serialization.DataMemberAttribute()]
public ias.officeline.mobileservice.ppsFaRueckmeldungItem FaItem
{
get
{
return this.FaItemField;
}
set
{
if ((object.ReferenceEquals(this.FaItemField, value) != true))
{
this.FaItemField = value;
this.RaisePropertyChanged("FaItem");
//// You need to hook property changed event for complex proeperty.
this.FaItem.PropertyChanged += FaItem_PropertyChanged;
}
}
}
private void FaItem_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
//ensure to provide the proper complex property name in below,
RaisePropertyChanged("FaItem." + e.PropertyName);
}
|