突出显示行时是否触发任何事件? [英] Is there any event triggered when highlighting a row?
问题描述
我创建了一个ListView来显示文档列表,然后创建了一个按钮 Button A来执行一些操作,我的要求是我希望按钮状态可以随着所选文档的更改而改变。
I created a ListView to show the list of documents, then created a button "Button A" to do some actions, my requirement is I would like the button status may be changed with the selected document changes.
Fox示例:下图中有三个文档,我希望在单击Order-00001或Order-00002时启用该按钮,并且对于Order禁用该按钮-00003,因为其中没有钱。
Fox example: there are three documents in the following graphic, I want the button is enabled when I click Order-00001 or Order-00002, and it is disabled for Order-00003 due to no money in it.
如果您能给我提示,当我单击一行时是否有任何事件要发生,我将不胜感激。非常感谢。
I appreciate if you could give me a hint if there is any event to be raised when I click a row. Thanks a lot.
推荐答案
为减少回调到服务器,没有选择行的事件。而是使用PXToolbarButton StateColumn属性来控制按钮的启用状态。
To reduce callback to the server there isn't a row selected event. Instead there is PXToolbarButton StateColumn property to control the button enabled state.
在声明按钮时,您将指定一个布尔DAC字段,该字段将基于该按钮启用/禁用按钮值。请注意,该按钮需要将DependOnGrid属性设置为网格的ID才能获取所选行:
When you declare your button, you specify a Boolean DAC field that will enable/disable the button based on it's value. Note that the button needs the DependOnGrid property set to the ID of the grid to get the selected row:
<px:PXToolBarButton Text="Button A" DependOnGrid="grid" StateColumn="IsButtonVisible">
IsButtonVisible是一个自定义的未绑定布尔DAC字段(您可以选择所需的任何名称,但isSelected / Selected除外)为复选框保留):
IsButtonVisible is a custom unbound Boolean DAC field (you may choose any name you want except isSelected/Selected which is reserved for checkbox):
#region IsButtonVisible
public abstract class isButtonVisible : IBqlField
{
}
protected bool? _IsButtonVisible;
[PXBool]
[PXUIField(DisplayName = "Is Button Visible", Enabled = false, Visible = false)]
public virtual bool? IsButtonVisible
{
get
{
return _IsButtonVisible;
}
set
{
_IsButtonVisible = value;
}
}
#endregion
您可以设置值根据您的业务逻辑在RowSelected事件中获取IsButtonVisible的信息:
You can set the value of IsButtonVisible in the RowSelected event based on your business logic:
protected virtual void DAC_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
DAC row = e.Row as DAC;
if (row != null)
{
bool yourCondition = ???;
row.IsButtonVisible = yourCondition;
}
}
来源:
启用禁用按钮网格或PXToolBarButton的数量,取决于Acumatica中列的值
这篇关于突出显示行时是否触发任何事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!