liferay のカスタム ポートレットに 1 つの html テーブルがあります。その特定の列のクリックで編集機能を提供したいのですが、liferay-ui:search-container がこのような機能を提供することは知っていますが、これには html テーブルといくつかの jquery を使用しています。アイコンをクリックすると、編集ページにリダイレクトされますが、その行の編集アイコンの主キーを選択する方法が必要です..??
アイコン表示用の次のjqueryがあり、編集ページにリダイレクトします
<script>
$(document).ready(function() {
$(".editable").hover(function(){
$(this).append("<i class='splashy-pencil_right'></i>")
}, function(){
$(this).children("i").remove();
});
$(".editable").click(function(){
$.colorbox({
initialHeight: '0',
initialWidth: '0',
href: "#confirm_dialog",
inline: true,
opacity: '0.3',
onComplete: function(){
$('.confirm_yes').click(function(e){
e.preventDefault();
window.location.href = "<%=editURL.toString() %> ";
$.colorbox.close();
});
$('.confirm_no').click(function(e){
e.preventDefault();
$.colorbox.close();
});
}
});
});
//* show all elements & remove preloader
setTimeout('$("html").removeClass("js")',1000);
});
</script>
以下は、リダイレクトしたいポートレットアクションの URL です。
<portlet:actionURL name="editRestaurant" var="editURL">
<portlet:param name="key" value="<%=restId%>" />
</portlet:actionURL>
次のコードは、非表示フィールドとして主キー値(restID)を取得しているビュー クラスのフィールドです。
<form action="<%=editURL.toString() %>" method="post">
<table class="table table-bordered table-striped" id="dt_gal_res">
<thead>
<tr>
<th class="table_checkbox"><input type="checkbox" name="select_rows" class="select_rows" data-tableid="dt_gal_rest" /></th>
<th>Name</th>
<th>Contact Person</th>
<th>Website</th>
<th>Emenu</th>
<th>Status</th>
</tr>
</thead>
<%
List<restaurant> rest_listOBJ= restaurantLocalServiceUtil.getAllAvailableRestaurant();
for(int i=0;i<(rest_listOBJ.size());i++)
{
restaurant temprest=rest_listOBJ.get(i);
%>
<tbody>
<tr>
<td><input type="checkbox" name="row_sel" class="row_sel" /></td>
<td style="visibility: hidden;"><input type="text" name="primerykey" value="<%= temprest.getPrimaryKey()%>"></td>
<td class="editable"><%=temprest.getName() %></td>
<td><%=temprest.getContactno() %></td>
<td><%=temprest.getWebsite() %></td>
<td><%=temprest.getNoofemenuagent() %></td>
<td><a href="#" class="pop_over" data-content="Ad Displayed on </br> <b>Restaurant</b> : ABC" data-original-title="( Ad name )" data-placement="left">Pending</a></td>
</tr>
</tbody>
このクリックされた行または列の値を edit_restaurant.jsp ページに転送するにはどうすればよいですか?