Ajax p:dataTable全选复选框 函数sellectAll(数据表){ var checked=$(文档).find(“:checkbox”)[“5”].checked;///查找复选框标题并验证是否选中复选框 如果(选中===true){ PF(datatable).selectAllRows();//如果为true,则从datatable中选择AllRows }否则{ PF(datatable).unselectAllRows()// } }
数据表Ajax p:dataTable全选复选框 函数sellectAll(数据表){ var checked=$(文档).find(“:checkbox”)[“5”].checked;///查找复选框标题并验证是否选中复选框 如果(选中===true){ PF(datatable).selectAllRows();//如果为true,则从datatable中选择AllRows }否则{ PF(datatable).unselectAllRows()// } },ajax,jsf,primefaces,Ajax,Jsf,Primefaces,数据表 <script type="text/javascript"> function sellectAll(datatable) { var checked = $(document).find(":checkbox")["5"].checked; ///Find checkbox header and verify if checkbox is checked if (checked === true) {
<script type="text/javascript">
function sellectAll(datatable) {
var checked = $(document).find(":checkbox")["5"].checked; ///Find checkbox header and verify if checkbox is checked
if (checked === true) {
PF(datatable).selectAllRows(); // if true, selectAllRows from datatable
} else {
PF(datatable).unselectAllRows(); //
}
}
</script>
如果只有一个datatable,则“全选”有效,但是如果页面有多个datatable,则在我取消选择datatable(我首先选中了datatable)后,“全选”无效既然可以在jsf managedBean中执行,为什么要在JS中执行某些操作?!?请添加您的datatble结构我想这会有帮助我添加了数据表结构我看到了用
onclick
onclick在Ajax组件中不支持的更改onclick
onclick问题是您试图调用客户端方法(您是JS方法)使用服务器端方法,既然可以在jsf managedBean中进行操作,为什么还要在JS中进行操作?!?请添加您的datatble结构我想这会有帮助我添加了数据表结构我看到了用onclick
onclick在Ajax组件中不支持的更改onclick
onclick。问题是您试图用服务器端方法调用客户端方法(您的JS方法)
<p:dataTable value="#{itemCardWithoutCostBean.warehousesList}" widgetVar="warehouseList" selection="#{itemCardWithoutCostBean.selectedWarehouses}" rowKey="#{warehouse.warehouseCode}"
rows="10" paginator="true"
styleClass="ui-datatable-hor-scroll" scrollWidth="100%" paginatorPosition="bottom" var="warehouse">
<p:ajax event="toggleSelect" oncomplete="sellectAll(warehouseList)" />