E10.2 Updatable dashboard - force save dirty rows?


(Joe D Trent) #1

Hi,

I have an updatable dashboard that’s working just fine as long as the user clicks Save after changing data on one or more rows. But a refresh, clear, exit, etc. discards the changes. If I switch to another tab and come back to the original, the dashboard has saved the data.

I’ve tried capturing the toolclick and executing oTrans.Update() with no effect.

Have another suggestion?

Thanks,

Joe


(Brandon Anderson) #2

Does if have to be multiple rows? In a BAQ it’s a lot more convenient but in a dashboard, if you don’t allow multiples, then it saves as soon as you change row. You still have to save for the specific row your on, but that’s more intuitive.


(Joe D Trent) #3

Thanks, Brandon. I was concerned that users on an MES station wouldn’t save that last line, so came up with something alternative.

I was verifying the change on a BeforeFieldChange anyway, so I just set a dirtyRows variable to true, then added another check on toolclick and an exception to stop the tool action if we need to save. A bit clunky, but maybe will save lost changes.

For your entertainment:

private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{
	// update dirty rows
	if (args.Tool.Key == "SaveMenuTool")
		{dirtyRows = false;}
	
	if (dirtyRows)
	{
		DialogResult result;
		result = MessageBox.Show("Save Changes?", "Changes Active", MessageBoxButtons.YesNo);
		
		if (result == DialogResult.Yes) // clunky, but gets it done
			{throw new Ice.BLException("Click Save to Update."); }
	}

	if (args.Tool.Key == "ClearTool")
	{
		txtJobNum.Value = "";
		numAssemblySeq.Value = 0;
		cmbOperation.Value = "";
		operationList = "";
		fillCmbOperation();
		setSearches();
		txtAssyPartNum.Value = "";
		txtAssyPartDesc.Value = "";
	}
}

private void Results_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
{
	// ** Argument Properties and Uses **
	// args.Row["FieldName"]
	// args.Column, args.ProposedValue, args.Row

	switch (args.Column.ColumnName)
	{
		case "JobMtl_QtyPer":

			if (Convert.ToBoolean(args.Row["JobMtl_AlwaysReplace_c"]) == true && 
					Convert.ToDecimal(args.ProposedValue) != Convert.ToDecimal(args.Row["JobMtl_QtyPer"]))
			{
				args.ProposedValue = args.Row["JobMtl_QtyPer"];
				MessageBox.Show("Value not changed. This item marked 'Always Replace.'");
			}
			else
			{
				dirtyRows = true;
			}
		break;
	}
}