2012-07-13 70 views
1

我在我的應用程序中使用顯示標記。在這我需要根據列標題點擊排序表內容。列標題具有鏈接導航。相反,我需要在點擊表格列標題的同時提交表單。我們如何才能做到這一點。如何更改displaytag sortproperty鏈接

截至目前,我的應用程序craetes這樣的表,

<display:table id="data" name="lstEntities" 
         sort="external" uid="row" htmlId="rowid" class="tborder" 
         excludedParams="*" style="width:100%" 
         pagesize="${pageCriteria.recordsPerPage}" partialList="true" 
         size="${pageCriteria.totalRecords}" export="false" 
         requestURI="prestigeBrandListMDA.action"> 
         <display:column property="brandId" sortName="brand.brandId" 
          sortable="true" titleKey="table.title.brandId" 
          style="width:100px" /> 

<thead> 
<tr> 
<th class="sortable"> 
<a href="prestigeBrandListMDA.action?d-16544-p=1&amp;d-16544-o=2&amp;d-16544-n=1&amp;d-16544-s=brand.brandId">Sales Brand Id</a></th> 

相反,我需要一個像下面

<thead> 
<tr> 
<th class="sortable"> 
<a href="#" onclick="javascript:submitform(prestigeBrandListMDA.action?d-16544-p=1&amp;d-16544-o=2&amp;d-16544-n=1&amp;d-16544-s=brand.brandId)">Sales Brand Id</a></th> 

回答

0

據我所知,目前還沒有辦法做到這一點的鏈接使用displaytag。使用JQuery ready event即時更改鏈接。

1

是的,我用Jquery來實現這個功能.thanks.i使用下面的代碼來實現它。

$('.sortable').each(function(event){ 
       var obj = $(this).find('a').attr('href'); 
       var urltext = 'javascript:submitform("'+contextPath+'/'+obj+'\")'; 
       $(this).find('a').attr('href', urltext); 
      });