刷新DIV中包含dojo选项卡面板的JSP部分



我有一个jsp包含选项卡面板使用dojo。这是JSP -

<div id="protoDevTDPRevLogTab">
    <sx:tabbedpanel id="tabContainer" selectedTab="2" >
        <sx:div label="Prototype Development (Virtual/Physical)" id = "protoDevTabId" disabled="true" >
            Prototype Development (Virtual/Physical)                
        </sx:div>
        <sx:div label="Set Maker Layout"  theme="ajax" preload="true" href="%{protoDevTDPRevLogDTO.url}" id = "protoDevTDPRevLogDTO.setMLTabId" disabled="true"/>
        <sx:div label="Set Maker Layout"  theme="ajax" preload="true" href="%{protoDevTDPRevLogDTO.url}" id = "protoDevTDPRevLogDTO.setMLTabId" disabled="%{protoDevTDPRevLogDTO.disabled}" />
        <sx:div label="Shipping / Line Trial" id = "protoDevTDPRevLogDTO.shippingLTTabId" >
            <table width="100%" cellpadding="0" cellspacing="0" id="shippingLineTrial">
                <tr class="tab_inputrow"/>
                <tr class="tab_inputrow">
                    <td width="30%">
                    <input type="button" value="Go For TDP Creation" id="goForTDPCreationbtnId" class="btn_enabled" 
                        onclick="sendNotificationToPackSuplier();" style="width: 120px" align="left"></input>
                    </td>
                </tr>
                <tr class="tab_inputrow"/>
            </table>
        </sx:div>
    </sx:tabbedpanel>
</div>

在其中一个表上的按钮单击我必须做一些业务逻辑,这将改变其他选项卡中的数据。

所以我想刷新整个选项卡面板。

我已经尝试使用jQuery ajax像这样-

    $.ajax({
          type: "POST",
          url: "updateMLSupplier.action?packSupplierNumber="+packSupplierNumber+"&packSupplierName="+packSupplierName+"&rcmid="+rcmid,
          data: "data",
          success: function (response) {
            var url = "tabbedProtoDevTDPRevLog.action?&packSupplierName="+encodeURIComponent(packSupplierName)+"&rcmid="+encodeURIComponent(rcmid);
// This url has the code to refresh the data contained in tabbed panel.
//Also the success of this ajax is the tabbed jsp.
            $("#protoDevTDPRevLogTab").load(url);
        },
          dataType: "text"
    });

这是struts映射-

<action name="tabbedProtoDevTDPRevLog" class="protoDevTDPRevLogAction" method="loadProtoDevTDPRevLog">
        <result name="success">tabbedPanel.jsp
        </result>
</action>

问题是- tabbedPanel.jsp有代码像:<sx:tabbedpanel id="tabContainer" selectedTab="%{protoDevTDPRevLogDTO.tabToDisplay}" >,所以在jQuery ajax加载方法的Dojo前缀被替换为一些Dojo javascript。最终的结果是JSP没有在指定的DIV中被替换。

这个问题有没有别的解决办法?我唯一关心的是刷新dojo选项卡面板内容。

我使用jQuery选项卡实现了解决方案,并包括dojo的动态内容,如下-

<div id="protoDevTDPRevLogTab">
                  <ul>
                    <li><a href="#tabs-1">Prototype Development (Virtual/Physical)</a></li>
                    <li><a href="#tabs-2">Set Maker Layout</a></li>
                    <li><a href="#tabs-3">Shipping / Line Trial</a></li>
                    <li><a href="#tabs-4">TDP Verification</a></li>
                  </ul>
                  <div id="tabs-1">
                    <p>Prototype Development (Virtual/Physical)</p>
                  </div>
                  <div id="tabs-2">
                    <sx:div label="Set Maker Layout"  theme="ajax" preload="true" href="%{protoDevTDPRevLogDTO.url}" id = "protoDevTDPRevLogDTO.setMLTabId" disabled="true"/>
                  </div>
                  <div id="tabs-3">
                    <sx:div label="Shipping / Line Trial" id = "protoDevTDPRevLogDTO.shippingLTTabId" >
                            <table width="100%" cellpadding="0" cellspacing="0" id="shippingLineTrial">
                                <tr class="tab_inputrow"/>
                                <tr class="tab_inputrow">
                                    <td width="30%">
                                    <input type="button" value="Go For TDP Creation" id="goForTDPCreationbtnId" class="btn_enabled" 
                                        onclick="sendNotificationToPackSuplier();" style="width: 120px" align="left"></input>
                                    </td>
                                </tr>
                                <tr class="tab_inputrow"/>
                            </table>
                        </sx:div>
                  </div>
                  <div id="tabs-4">
                        <sx:div label="TDP Verification" theme="ajax" preload="true" href="tdpVerfication" id = "protoDevTDPRevLogDTO.tdpVerificationTabId" disabled="%{protoDevTDPRevLogDTO.disabled}" />
                  </div>
</div>

javascript code -

$(document).ready(function() {
            $("#protoDevTDPRevLogTab").tabs({selected:1,disabled: [0]});
//this will change conditionally.
            $('[href="#tabs-2"]').closest('li').hide();
            $('[href="#tabs-3"]').closest('li').hide();
    } );

服务器端代码保持不变

最新更新