0

テーブル内のレコードを返す検索クエリを作成しました。返されたレコードでコマンドを使用して、それらを編集してテーブルにのみ保存できるようにしました。しかし、テーブル内のレコードを変更して [保存] ボタンをクリックした後、テーブル内のレコードを更新できません。「再レンダリング」を使用して更新されたデータを表示するにはどうすればよいですか? 私が使用しているページ コードとコントローラー アクションは以下のとおりです。

<!-- Page -->
<apex:pageBlock id="pb1">
  <apex:outputPanel id="pan">
    <apex:pageBlockTable value="{!l1}" var="k" rendered="{!flag}" id="pb">
      <apex:column value="{!k.First_Name__c}"/>
      <apex:inlineEditSupport showOnEdit="saveButton, cancelButton" hideOnEdit="editButton" event="ondblclick" changedStyleClass="myBoldClass" resetFunction="resetInlineEdit"/>
      <apex:column value="{!k.Last_Name__c}"/>
      <apex:inlineEditSupport event="ondblclick" showOnEdit="save"/>
      <apex:column value="{!k.E_mail__c}"/>
      <apex:inlineEditSupport event="ondblclick" showOnEdit="save"/>
      <apex:column value="{!k.Employee_ID__c}"/>
      <apex:commandButton action="{!save}" id="saveButton" value="Save" />
    </apex:pageBlockTable>
  </apex:outputPanel>

  <apex:commandButton action="{!edit}" id="editButton" value="Edit"/>
  <apex:commandButton action="{!save}" id="saveButton" value="Save"/>
  <apex:actionSupport event="onclick" rerender="pan" status="refreshstatus"/>
  <apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
  <apex:actionStatus id="refreshstatus" startstyle="color:green;" startText="Saving....">
  </apex:actionStatus>
</apex:pageBlock> 

// controller action
public pagereference save(){update l1;return null;}}
4

1 に答える 1

1

ここでコードの一部を投稿することは大いに役立ちますが、その長い部分と短い部分は次のとおりです。

<!-- put your table in a panel with an ID -->
<apex:outputPanel id="thePanel:>
  <!-- put your table here -->
</apex:outputPanel>

<!-- specify the panel's ID as the rerender target for the action -->
<apex:commandButton value="Save" action="{!TheSaveAction}" rerender="thePanel"/>

そして、コントローラーが次Pagereferenceの値の a を返すことを確認しますnull

public Pagereference TheSaveAction()
{
  // save
  return null;
}

これを行った後もまだ苦労している場合は、何が起こっているのかを確認できるように、ページ コード (または関連する部分) を挿入してください。

于 2012-01-31T22:57:06.787 に答える