2

在使用 Spring MVC 4.0.6、Dandelion Datatables 1.1.0 和 Dandelion Datatables Jsp 1.1.0 的项目中,我有两个 jsps:

JSP1(简体)

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="datatables" uri="http://github.com/dandelion/datatables" %>

<form:form id="contractForm" class="form-horizontal" action="create"
     method="POST" modelAttribute="contractForm" novalidate="novalidate">

  <label for="legalIdentifier">
    <span>*</span> <fmt:message key="customers.cu.form.legal.id" />:
  </label>
  <form:input type="text" id="legalIdentifier" path="legalIdentifier" required="true"/>
  <span class="btn btn-success" id="nifSearch">
    <i id="searchIcon" class="fa fa-search"></i>
  </span>

  <div id="block_addresses_table">
      <!--At first the table will be empty-->
      <jsp:include page="jsp2.jsp" />
  </div>

</form>

<script type="text/javascript">

    $(document).ready(function(){}

        $('#nifSearch').click(function(){
            $(this).button('loading');

            // find customer returns jsp2.jsp with data
            $('#block_addresses_table').load('findCustomer','nif=' + $('#legalIdentifier').val(),
                function(response, status) {
                    $('#nifSearch').button('reset');                    
                }
            );          
        });

</script>

JSP2(简化)

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="datatables" uri="http://github.com/dandelion/datatables" %>

<datatables:table id="addressesList" data="${contractForm.customer.addresses}" row="address" pagingType="bootstrap_simple" dom="tp" sortable="false">
    <datatables:column titleKey="customers.cu.form.address" property="completeAddress" />
</datatables:table>

问题

实际问题是第一次JSP1加载,表的配置就正确完成了。但是,当单击按钮并jquery.load()执行时,表的配置是默认配置,而不是我指定的配置。

当使用 JQuery 加载表时,这实际上发生在应用程序的几个部分。

4

0 回答 0