Visualforce页面apex:commandXXXX的rerender使用注意事项

Visualforce页面apex:commandXXXX的rerender使用注意事项


 rerender 可以指定页面重画区域,这个其实就是visualforce中的AJAX 技术。

但是,要保证这个有效果,有些注意事项。

1. rerender可以指定的区域,目前只发现apex:outputpanel 标记好用。 用DIV的话不行。

   通常的写法例子如下:

<apex:page controller="SearchController">

<apex:form>
    <apex:inputText value="{! freeWord }" size="60" />
    <apex:commandLink value=" 搜索 " title=" 搜索 " rerender="opSearchResultByFreeWord"
       id="searchBtn" action="{! doFreeWordSearch }" />

    <!-- 下面是显示搜索结果的区域 -->
    <apex:outputPanel id="opSearchResultByFreeWord">
        <apex:pageBlock id="resultBlock"  >
            <apex:pageBlockTable value="{! searchRsltByFreeWord }" var="item"
                <apex:column headerValue="名称" >
                    <apex:outputField value="{!item.name}" />
                </apex:column>
                <apex:column headerValue="说明" >
                    <apex:outputField value="{!item.describe__c}" />
                </apex:column>
           </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:outputPanel>

</apex:form>
</apex:page>

2. 如果outputPanel里面有rendered指定的话,这个区域也是没有办法重画的。

 简单的处理办法是,在这个outputPanel外面再嵌套一层outputPanel,并设置Id,这样就可以用了。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值