我有一個Liferay-AUI數據庫,爲此我希望允許單行選擇,並在每個行被選中時進一步調用腳本。該腳本需要確定剛纔選擇的行,並採取一些行動。使用Liferay AUI數據表的行選擇
以下是當前實施的示例。如何添加上述要求的建議將不勝感激。
<div id="productsTable"></div>
<aui:script use="datatable,datatable-sort,datatable-scroll,datatable-highlight,datatable-selection,liferay-portlet-url">
var roleColumns = [ {
label : 'Providing Role Name',
key : 'providerRoleName',
sortable : true,
allowHTML : true,
formatter : function(o) {
var renderURL = Liferay.PortletURL
.createURL('<%= productDetailUrl %>');
renderURL.setParameter('productId', o.data.productId);
return '<a href="' + renderURL.toString() + '">'
+ o.data.providerRoleName + '</a>';
}
}, {
label : 'Cardinality',
key : 'cardinality',
sortable : true
} ];
new A.DataTable({
columns : roleColumns,
rowSelect: 'mousedown',
data : <%=renderRequest.getAttribute("roles")%>,
scrollable : "xy",
height : "400px",
width : '100%',
sort : 'true',
highlightRows : true
}).plug(A.Plugin.DataTableSelection, {
selectRow : true
}).render('#productsTable');
</aui:script>
感謝您的建議。不幸的是,上述不適合我。我確實發現了一些小的變化,但選擇了另一種解決方案(請參閱下一篇文章)。 –