<display:table export="false" id="data" name="helpdeskTickets" requestURI="/dofetchassignedtickets.action" pagesize="5" > <div id="tabheadM" class="tableHeader"></div> <display:column property="id" title="Ticket ID" sortable="true" /> <display:column property="subject" title="Subject" sortable="true" /> <display:column property="module.name" title="Module" sortable="true" /> <display:column property="subModule.name" title="SubModule" sortable="true" /> <display:column property="createDate" title="Created At" sortable="true" /> <display:column property="priority" title="Priority" sortable="true" /> <display:column property="ticketstatus" title="Status" sortable="true" /> <display:column title="Action" href="javascript:viewTicketDetail('${data.id}');"> <img src="<%=request.getContextPath()%>/images/ViewDetails.png" /> </display:column>
对于多个行,仅获取第一个值,而获取相同的值。我想传递不同的价值观。
function viewTicketDetail(id) { // }
请帮助。
下面是更改后的代码。但是我仍然对所有行都得到相同的值:(
<display:table export="false" id="data" uid="row" name="helpdeskTickets" requestURI="/dofetchassignedtickets.action" pagesize="5" > <display:column property="ticketstatus" title="Status" sortable="true" /> <display:column property="id" title="Action" href="javascript:viewTicketDetail('${row.id}');">
您应该将uid属性添加到表中。
uid
<display:table export="false" id="data" uid="row" name="helpdeskTickets" requestURI="/dofetchassignedtickets.action" pagesize="5" >
然后使用OGNL
viewTicketDetail('<s:property value="%{#attr.row.yourAttribute}"/>');
或使用EL
viewTicketDetail('${row.yourAttribute}');
使用列
<display:column title="Action"> <a href="javascript:viewTicketDetail('<s:property value="%{#attr.row.id}"/>');"><img src="<s:url value='/images/ViewDetails.png'/>" /></a> </display:column>