Hi there,
Excuse me as this seems like it's been asked before but I can't seem to get it to work.
Essentially, I have a Grid that has a "Tag" column (a bool checkbox).
This could be pre-tagged from the database.
When a user tags a row, I want to ask the user a question "Are you sure?"
- If yes, I want to tag it and do something.
- If no, I want to cancel the whole thing - as if he did nothing.
My questions is/are:
When do you show the checkbox to cancel the editing if he says no? From other issues I've found, I'm to place it inside ShowingEditor - which does actually work, but if user chooses "Yes", I need the row to be tagged and commit the row - I don't want to stay in editing. How can I do this?
Reason for this, as if its in edit mode, the user can tag and untag it as much as he wants without ShowingEditor firing. I want it to fire every single time.
User flow:
Grid with taggable row : http://i.imgur.com/q453enz.png
User clicks the checkbox: http://i.imgur.com/AMgI49C.png
Presses Yes => Tag row and commit editing, but it says in edit form: http://i.imgur.com/IJbPE3E.png
My ShowingEditor method:
C#private void gcLines_OnShowingEditor(object sender,
ShowingEditorEventArgs e)
{
if (e.RowHandle != GridControl.AutoFilterRowHandle)
{
var viewModel = (LoadTrucksViewModel)this.DataContext;
if ((bool)e.Value)
{
e.Cancel = !viewModel.AskToConfirmUnloadSelectedRoute();
if (!e.Cancel)
{
viewModel.LoadSelectedRoute();
}
}
else
{
e.Cancel = !viewModel.AskToConfirmLoadSelectedRoute();
if (!e.Cancel)
{
viewModel.LoadSelectedRoute();
}
}
}
gcLines.View.PostEditor();
gcLines.View.CommitEditing();
e.Handled = true;
}
I've tried adding those last 3 lines to no effect.