Skip to main content

We have a requirement to add a checkbox to the grid in Employee Time Activities. It needs to be enabled and editable and thus, persistable, when the activity is released.

Standard SetEnabled in RowSelected does not work. Enabling the entire column in header also does not work. Overriding the original RowSelected event, where the row is disabled for released activities also does not work for some reason. Any ideas?

Hello @stanaistov , everything is working fine for me. I tried in the last build version of 24R1.

Please let me know which build version you are using.
You can find the working code below:

// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public class EmployeeActivitiesEntryExt : PXGraphExtension<EmployeeActivitiesEntry>
{
public virtual void _(Events.RowSelected<EPActivityApprove> e)
{
if (e.Row is EPActivityApprove)
PXUIFieldAttribute.SetEnabled<EPActivityApprove_Ext.usrTestField>(e.Cache, e.Row);
}
}

// Acuminator disable once PX1016 ExtensionDoesNotDeclareIsActiveMethod extension should be constantly active
public sealed class EPActivityApprove_Ext : PXCacheExtension<EPActivityApprove>
{
#region UsrTestField
PXBool]
PXUIField(DisplayName = "Test Field")]
public bool? UsrTestField { get; set; }
public abstract class usrTestField : BqlBool.Field<usrTestField> { }
#endregion
}

And simple ASPX:

<px:PXGridColumn DataField="UsrTestField" Width="60" Type="CheckBox" />


 

 


I tried that before and it does not work. I am using 23.110.0025.


I tried that before and it does not work. I am using 23.110.0025.

Then could you please share your code and aspx here?


The code provided by @harutyungevorgyan should work. 

What might cause the issue is name of the field (I’ve seen similar issues with fields not adhering to “usr” prefix convention) or different event used to define SetEnabled - in the base graph I see multiple instances of PXUIFieldAttribute.SetEnabled(sender, row, false); for EPActivityApprove, which disables all fields. Generally it is used to disabled all fields except 1-2 specific fields - which are then enabled like this: PXUIFieldAttribute.SetEnabled<EPActivityApprove.hold>(sender, row, true);.

Depending on the event you used, your instructions might become overridden by this disable all command.

Please also check attributes on your field, maybe you set PXUIField(Enabled = false)] by accident.

I agree with @harutyungevorgyan, it’d be easier for us to help if we can see the code and markup changes.


Hi @stanaistov were you able to find a solution? Thank you!


Reply