我知道这是保存记录的方法
<apex:commandButton action="{!save}" value="Save"/>我想要一个按钮,不保存当前记录(即,取消)并导航到已保存记录的列表(即该对象类型的对象列表)。
就像这样..。
<apex:commandButton action="{!cancel}" value="Cancel"/>发布于 2021-04-13 09:44:29
另一个答案建议调用标准控制器的cancel操作,因此我想对此进行扩展,因为它将我引向解决类似问题的方向。
如果你想在不刷新整个页面的情况下取消ajax请求的编辑,声明操作为void,不返回页面引用,但仍然调用标准控件上的“cancel”操作。确保命令按钮指定了rerender属性。
// controller extension
public class TimeSheetExtension
{
ApexPages.standardController m_sc = null;
public TimeSheetExtension(ApexPages.standardController sc)
{
m_sc = sc;
}
public void doCancel()
{
m_sc.cancel();
}
}
// page
<apex:commandButton action="{!doCancel}" value="Cancel" rerender="container_id"/>https://stackoverflow.com/questions/8921434
复制相似问题