问题
I have a selected checkbox on a custom grid is not triggering the Fieldupdated event.
protected void MyTable_Selected_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated del)
{
del?.Invoke(cache, e);
var row = (MyTable)e.Row;
if(row.Selected == true )
{
//
}
}
The following is the code in aspx page
<px:PXCheckBox ID="edSelected" runat="server" AlreadyLocalized="False" CommitChanges="True" DataField="Selected" Text="Selected">
</px:PXCheckBox>
DAC definition for the field
#region Selected
public abstract class selected : IBqlField { }
/// <summary>
/// Used for selection on screens.
/// </summary>
[PXDBBool]
//[PXDefault(false)]
[PXUIField(DisplayName = "Selected")]
public virtual bool? Selected { get; set; }
#endregion
When i click in the grid there is a red mark appears and the value is not committed on server side.
回答1:
I had the same problem and I figured out the property "BatchUpdate" was set to "true" on the Grid, which prevents the changes to be commited to the server.
Once I set it to false it works fine :
来源:https://stackoverflow.com/questions/52609314/checkbox-control-in-a-grid-is-not-triggering-fieldupdated-event