Try to use the before toolclick event, look for a refresh button press and then evaluate if there is a changed row in the data set. If there is throw the native save dialog.
EpiString.DialogInfo di = EpiString.GetDialogInfo("UpdateOnFormClose");
var res = EpiCheckMessageBox.Show(di.Message, di.Title, di.Buttons);
if(res.Result == DialogResult.Yes)
{
// SAVE CODE
}
Hmmmm… just noticed “before” and “after” toolclick events don’t seem to be working for UBAQ customizations.
The toolclick event does fire though.
TBD if that is just the way it is, or maybe a version thing.
Admittedly I havent read the whole thread here, but if I am picking up the context, I have found that if you want perform actions against ALL rows in a UBAQ you need ACTIONS as Update will only work on modified rows. You can however use an action to modify all rows in a UBAQ programmatically.
Specific to the OP, instead of before tool click, cant you do a BeforeAdapter method?
Thanks, sounded like a good idea, but…
when I looked at the FormEvent Wizard - BeforeAdapterMethod the Adapters dropdown was blank.
on a UBAQ form customization,
This one just caught my interest… SheaM made the original post, not sure still needs it.
I keep poking around when I get a minute… just because I haven’t really looked at UBAQ form customizations too much before.
Starting to realize the differences now, kind of making sense why.
I wonder if you can code your own before adapter method. As long as you can get ahold of the DynamicQuery adapter in the form you should be able to. Also, this is a deployed Dash right?
Like Bruce has previously said in his posts, a lot of the suggestions haven’t panned out due to some Epicor bugs/issues related to the UBAQ.
I have actually managed to ALMOST completely solve my original problem through creating a UD checkbox field that is toggled to TRUE through a Value Change Row Rule.
I then have code on a Tool Click Event that will query each Row for the TRUE fields and Prompt a YES/NO message box that will save when YES is selected.
Then in the Background I have a Data Directive that sets the UD field to False every time there is an updated row in that table.
It’s a little clunky but I had a deadline and it seems to be doing the trick.
The only problem now is the code I have to check each Row for a True checkbox is using a foreach statement which is then showing a save prompt for EVERY row that has been changed.
Currently working on modifying that to a Count if I can, Count every True and if the Count is greater than 0 then show the save prompt
This is what I’ve got right now, I took my previous code which was working, and slotted it into the format you provided. The messagebox at the end was just for testing purposes, instead of it prompting to save every time I tested it.
private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{ EpiUltraGrid myGrid;
myGrid = (EpiUltraGrid)csm.GetNativeControlReference("5925c581-5da3-4aee-8fc1-66ea887789d1");
if (args.Tool.Key == "RefreshTool")
{
bool hasChange = false;
foreach(Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)
{
if (Convert.ToBoolean(row.Cells["JobAsmbl1_Teardown_Edited_c"].Value).Equals(true));
{
hasChange = true;
break;
}
if (hasChange);
MessageBox.Show("Did it Work?");
}
}
}