如何更改displaytag sortproperty链接

时间:2012-07-13 14:33:25

标签: java displaytag

我在我的应用程序中使用display标签。在那里我需要根据列标题点击对表内容进行排序。列标题具有链接导航。相反,我需要在单击表列标题时提交表单。我们怎样才能实现它。

截至目前,我的应用程序就像这样,

<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>

2 个答案:

答案 0 :(得分: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);
            }); 

答案 1 :(得分:0)

据我所知,使用displaytag无法做到这一点。使用JQuery ready event即时更改链接。