こんにちは、管理人の@Salesforce.Zです。
Visualforceの開発で画面の一部を変更したい場合には、サーバーへのアクセスが必要になります。
その際に使うのは、大体が「apex:actionFunction」か「apex:commandButton」だったのですが
actionSupport を使うといろいろ便利です。
しかし、たまに動作しないなあ、って悩むでしょう
今回、共有するノウホウは絶対役に立つとは言えないがまずお試しとして価値があるノウホウではないかと思っています。
読んだら得ること
★ actionSupport が動作しない場合まず試すノウホウ
目次
actionSupport 動作しない
サンプル
<!-- Page: --> <apex:page controller="exampleCon"> <apex:form> <apex:outputpanel id="counter"> <apex:outputText value="Click Me!: {!count}"/> <apex:actionSupport event="onclick" action="{!incrementCounter}" rerender="counter" status="counterStatus"/> </apex:outputpanel> <apex:actionStatus id="counterStatus" startText=" (incrementing...)" stopText=" (done)"/> </apex:form> </apex:page> /*** Controller: ***/ public class exampleCon { Integer count = 0; public PageReference incrementCounter() { count++; return null; } public Integer getCount() { return count; } }
動作しない場合、まずのノウホウ
実装によって、何かの原因で、動作しない場合がある
その時にまず、<apex:actionRegion>アクションサポート</apex:actionRegion>で囲んでみよう