Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ajax p:dataTable全选复选框 函数sellectAll(数据表){ var checked=$(文档).find(“:checkbox”)[“5”].checked;///查找复选框标题并验证是否选中复选框 如果(选中===true){ PF(datatable).selectAllRows();//如果为true,则从datatable中选择AllRows }否则{ PF(datatable).unselectAllRows()// } }_Ajax_Jsf_Primefaces - Fatal编程技术网

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)" />