[英]How to get total record on the current page(via YUI paginator) of Primefaces datatable
我在下面使用代碼:
<script type="text/javascript">
function test(){
var arr = product.getPaginator().getPageRecords(1);
}
</script>
<p:dataTable selection="true" widgetVar="product" id="cars" editMode="cell" editable="true"
var="carr" value="#{tabview.l1}" paginator="true" rows="3">
<p:column headerText="Model">
<h:outputText value="#{carr.model}" />
</p:column>
<p:column headerText="MANUFAC" style="width:20%">
<h:outputText value="#{carr.manufacturer}" />
</p:column>
</p:dataTable>
<p:commandButton oncomplete="test();" value="Test"/>
當我運行該代碼時,出現錯誤: Uncaught TypeError: Object [object Object] has no method 'getPageRecords'
在YUI指令中,該方法已經存在: http : //developer.yahoo.com/yui/paginator/#api
感謝您的關注 !
感謝所有關注,Primefaces不使用YUI,所以我必須解決:
$(PrimeFaces.escapeClientId('form:cars')).find('tr').length
function datatablelength(){
var dt = document.getElementById('myDatatable_data');
alert(dt.rows.length);
}
其中“ myDatatable”是我的p:datatable的ID
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.