Lock or Unlock Cell by Row Rule

Hi again!
I really appreciate this community. You all have been very helpful. Thank you for taking time out of your day to help me!

I have a dashboard with a BAQ. In the BAQ I have a calculated checkbox field called ‘Manual’ that = false. I also have two epicor fields: OrderRel.OurReqQty and OrderRel.ReqDate.

On the dashboard I would like to be able to have the date and qty fields locked so that normally users cannot edit the values. However, if the user clicks the checkbox to ‘unlock’ that row, then I want the two columns to get unlocked so that the user can edit the values before running the update method.

I see that I can set the column to read only, but at runtime it looks like read only is a ‘get’ property, and not a ‘set’ property.

How can I keep the two fields read only until the user indicates their intent to edit that record by clicking the checkbox?

Here is the base code I have so far. It creates the rule based on the checkbox, but I am not sure how to act on the rule once created:

	private void CreateRowRuleV_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEquals_true()
	{
		// Description: ManualEdit
		// **** begin autogenerated code ****
		RuleAction[] ruleActions = new RuleAction[0];
		// Create RowRule and add to the EpiDataView.
		// Dummy Context Object
		object contextObject = null;
		RowRule rrCreateRowRuleV_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEquals_true = new RowRule("V_Cust_OurUnmatchedOrders_faster_1View.Calculated_Manual", RuleCondition.Equals, true, new RowRuleActionDelegate2(this.V_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEqualstrue_CustomRuleAction), contextObject);
		((EpiDataView)(this.oTrans.EpiDataViews["V_Cust_OurUnmatchedOrders_faster_1View"])).AddRowRule(rrCreateRowRuleV_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEquals_true);
		// **** end autogenerated code ****
	}

	private void V_Cust_OurUnmatchedOrders_faster_1ViewCalculated_ManualEqualstrue_CustomRuleAction(Ice.Lib.ExtendedProps.RowRuleDelegateArgs args)
	{
		// ** RowRuleDelegateArgs Properties: args.Arg1, args.Arg2, args.Context, args.Row
		// ** put custom Rule Action logic here
		// set qty and date fields to readonly=false
		String myRef ="64a4559a-a942-4836-98d0-eb53fb6fc5c0";	
		EpiUltraGrid mesGrid;		
		mesGrid = (EpiUltraGrid)csm.GetNativeControlReference(myRef);
		/// these lines dont work
mesGrid.ActiveCell.Column("OrderRel_OurReqQty").ReadOnly=false;
mesGrid.ActiveCell.Column("OrderRel_ReqDate").ReadOnly=false;
	}

Thanks again for your time!
Nate

SO this is intended to work on a row-by-row level? Meaning you have that calculated boolean field named “Manual”, and that when that is checked, those other two fields - on just this row - are enabled for editing?

Obviously this would need to be a uBAQ for the edits to be writable back to the db. But how is the “Manual” filed checkbox updatable, such that you can check it?

Yes you got it right. Right now I set all three fields to updatable. So when I run the query I can check the checkbox, and then edit the required fields. I just want to lock them so users cant edit them unless they really mean to.

This is a uBAQ. I am using custom actions already. I hope that I can integrate this in with my custom update method.

Since it’s row by row, could you make the whole row editable? The uBAQ would only allow the updateble fields to actually update.

You should be able to do this with UltraGridColumn.CellActivation = Activation.AllowEdit /Activation.NoEdit

There’s a good source of starter code here:

Try doing a basic row rule in a customization on the deployed dashboard instead. You should not have to write any code that way (the wizard will do it for you).

this is what you are looking? if yes go dashboard gird properties -> View Rule Tab -> create new rules

3 Likes

Yes! This is what I really want to do, but I can’t figure out how to use the rule to change the locked status.

It seems like I can only set visual styles with the rules. How do I use the rule to set the locked status for other columns?

here is
image

2 Likes

This is good. I was trying to set the rules in my customization. I forgot to go all the way back to my dashboard definition. :stuck_out_tongue:

Right now the rule turns the read-only value on when I click the checkbox. How do I invert that so the read-only is set to false when I click the checkbox?

it will take care automatically

Did you set the Quantity and Date fields to “Prompt”?

Yes you have to set Prompt editable fields

image

Ahh! I forgot to set the rule to checkbox = false.
Thank you!!

1 Like