2012-03-26 111 views
0

Iam從Tapestry 5.0.18升級到5.1.0.5我的應用程序,我得到以下JavaScript錯誤。我知道5.1.0.5中的部分ajax響應的WaitForPage()有一個修復。但我仍然不斷gettin java腳本錯誤。以下是我的代碼。升級到Tapestry5.1 Javascript錯誤

 <table t:id="itemPanel" t:type="CustomSlidingPanel" closed="true" subject="literal:itemes" blockId="literal:itemPanel_content" linkToDisplay="New item" actionLink="newitem" zoneOnAction="itemZone"/> 
     <div id="itemPanel_content" style="display: none;"> 
      <table t:id="itemGrid" t:type="customGrid" source="item" row="itemRow" clientId="literal:itemGrid" rowId="itemRow.itemId" add="edit" include="type, item, price,store,startDate, endDate, ynprimary" inplace="true"> 
       <t:parameter name="editCell"> 
        <t:actionlink t:id="editItem" t:zone="itemZone" t:context="itemRow.id">Edit</t:actionlink> 
       </t:parameter> 
      </table> 
     </div> 
     <t:zone t:id="itemZone" visible="false"> 
      <t:delegate to="itemBlock" /> 
     </t:zone> 
     <t:block t:id="itemBlock"> 
      <div id="newitemDiv" class="dataEntry"/> 
      <div id="itemDivParent"> 
       <div id="itemDiv" class="dataEntry"> 
        <t:form t:id="itemForm" name="itemForm"> 
         <t:if test="itemObject.id"> 
          <script type="text/javascript">insertDivElement('itemGrid${itemObject.id}','itemDivParent','itemDiv','newitemDiv','8');</script> 
         </t:if> 
         <t:if test="newitem"> 
          <script type="text/javascript">createNewDivElement('itemDivParent','itemDiv','newitemDiv');</script> 
         </t:if> 
         <table t:id="itemComponent" t:type="item" itemObject="itemObject"/> 
         <div style="width: 50%" align="center"> 
          <input t:id="saveitem" t:type="Submit" class="button" value="Save" />&nbsp; <input type="button" class="button" value="Cancel" onClick="hideDivs('itemDivParent','itemDiv','newitemDiv');" />&nbsp; <t:if test="itemImported" negate="true"> 
           <input t:id="deleteitem" t:type="SubmitContext" class="button" value="Delete" t:context="itemObject.id" /> &nbsp;</t:if> 
         </div> 
         <br /> 
        </t:form> 
       </div> 
      </div> 
     </t:block> 

這是我得到的錯誤信息。看起來像在Tapestry.js中的「Tapestry.waitForPage(event)」有問題。有人可以幫忙嗎?

Message: Object doesn't support this property or method 
Line: 197 
Char: 1 
Code: 0 
URI: http://localhost:8080/ItemEntry?itemId=131686 
<a id="editItemPrice" onclick="javascript:Tapestry.waitForPage(event);" href="itementry.edititemprice/6578">Edit</a> 
+0

也許這只是一個瀏覽器緩存問題。在升級Tapestry之後,我曾經遇到過那些導致問題的舊腳本。清除緩存後,它工作。 – luukes 2012-03-27 08:05:44

回答

0

我相信這可能是涉及到combine scripts settingdiscussed on the mailing list。設置-Dtapestry.combine的腳本= false作爲一個VM參數或添加到您的AppModule:

public static void contributeApplicationDefaults(final MappedConfiguration<String, String> configuration) { 
    configuration.add(SymbolConstants.COMBINE_SCRIPTS, "false"); 
} 

你有沒有升級到5.3,雖然理由嗎?它有5.1的改進。

+0

感謝您的回覆。我們正在通過版本升級版本。我在哪裏設置Dtapestry.combine-scripts = false? – sreenaji 2012-03-27 15:09:41

+0

將它設置爲VM參數,以-Dtapestry.combine-scripts = false的形式啓動您的應用程序,或者將其添加到您的appmodule中,就像我在修改的答案中顯示的一樣。 – joostschouten 2012-03-27 15:19:55

+0

已添加到appmodule中,但它不起作用。我也清除了瀏覽器緩存並且沒有用。任何其他幫助將不勝感激。 – sreenaji 2012-03-27 16:11:00