我有一个 PXGrid 和一个 Checkbox 控件,头部容器中有一个复选框,网格位于详细信息容器中。我想要它,所以当复选框有值 = &#34; true&#34; 时,网格可以填充多行,如果复选框值< / em> = &#34; false&#34; 或 null ,网格只能填充单行。
我尝试过以下代码,但它对我没用。
protected virtual void BSMTNotification_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
if (e.Row == null) return;
BSMTNotification head = (BSMTNotification)e.Row;
if(head.Breakdown == false || head.Breakdown == null)
{
if(NotificationActivities.Select().Count != 0)
{
NotificationActivities.AllowInsert = false;
NotificationActivities.Cache.AllowInsert = false;
}
}
else
{
NotificationActivities.AllowInsert = true;
NotificationActivities.Cache.AllowInsert = true;
}
}
抱歉我的英语不好,谢谢。
答案 0 :(得分:1)
您的代码是正确的,但您也应该从NotificationActivity_RowInserted和NotificationActivity_RowDeleted调用它。那样:
protected virtual void NotificationActivity_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
{
if (e.Row == null) return;
BSMTNotification head = BSMTNotifications.Current;
if(head.Breakdown == false || head.Breakdown == null)
{
if(NotificationActivities.Select().Count != 0)
{
NotificationActivities.AllowInsert = false;
}
}
else
{
NotificationActivities.AllowInsert = true;
}
}
仅设置NotificationActivities.AllowInsert就足够了。也不需要设置NotificationActivities.Cache.AllowInsert。
此外,您应该确保“细分”复选框具有&#39; CommitChanges = true&#39; .aspx中的财产