All Downloads are FREE. Search and download functionalities are using the official Maven repository.

@kie-tools.dashbuilder-client.dist.org.dashbuilder.DashbuilderRuntime.js.patternfly.dataTables.pfSelect.min.js Maven / Gradle / Ivy

There is a newer version: 0.32.0
Show newest version
!function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function($){return factory($,window,document)}):"object"==typeof exports?module.exports=function(root,$){return root||(root=window),$&&$.fn.dataTable||($=require("datatables.net")(root,$).$),factory($,root,root.document)}:factory(jQuery,window,document)}(function($,window,document,undefined){"use strict";function selectAllRows(dt,select){var ctx=dt.settings()[0],filteredRows=dt.rows({page:"current",search:"applied"});if("single"===dt.select.style())throw new Error("Cannot select all rows with selection style 'single'");select?filteredRows.select():filteredRows.deselect(),$(ctx._pfSelect.selector,dt.table().container()).prop("checked",select),syncSelectAllCheckbox(dt)}function syncSelectAllCheckbox(dt){var ctx=dt.settings()[0],filteredRows=dt.rows({page:"current",search:"applied"}).flatten().length,selectedFilteredRows=dt.rows({page:"current",search:"applied",selected:!0}).flatten().length,selectAll=$(ctx._pfSelect.selectAllSelector,dt.table().container())[0];selectAll&&(selectAll.checked=filteredRows===selectedFilteredRows),updateSelectedRowsText(dt)}function syncSelectCheckboxes(dt){var ctx=dt.settings()[0];$(ctx._pfSelect.selector,dt.table().container()).prop("checked",!1),dt.rows({page:"current",search:"applied",selected:!0}).every(function(index){$(ctx._pfSelect.selector,dt.table().row(index).node()).prop("checked",!0)}),syncSelectAllCheckbox(dt)}function updateSelectedRowsText(dt){var ctx=dt.settings()[0],selectedRows=dt.rows({selected:!0}).flatten().length,totalRows=dt.rows().flatten().length;ctx._pfSelect.results!==undefined&&0!==ctx._pfSelect.results.length&&$(ctx._pfSelect.results).html(""+selectedRows+" of "+totalRows+" selected")}var DataTable=$.fn.dataTable,RESULTS_SELECTOR=".table-view-pf-select-results",SELECT_ALL_SELECTOR='th:first-child input[type="checkbox"]',SELECT_SELECTOR='td:first-child input[type="checkbox"]';return DataTable.pfSelect={},DataTable.pfSelect.init=function(dt){var ctx=dt.settings()[0],opts=ctx.oInit.pfConfig?ctx.oInit.pfConfig:{},select=ctx.oInit.select?ctx.oInit.select:{},style=dt.select.style();ctx._pfSelect={},ctx._pfSelect.selectAllSelector=opts.selectAllSelector!==undefined?opts.selectAllSelector:SELECT_ALL_SELECTOR,ctx._pfSelect.selector=select.selector!==undefined?select.selector:SELECT_SELECTOR,ctx._pfSelect.results=$(RESULTS_SELECTOR,opts.toolbarSelector),"api"===style?($(dt.table().container()).on("click",ctx._pfSelect.selectAllSelector,function(evt){evt.preventDefault()}),$(dt.table().container()).on("click",ctx._pfSelect.selector,function(evt){evt.preventDefault()}),dt.table().on("select.dt",function(){syncSelectCheckboxes(dt)})):($(dt.table().container()).on("click",ctx._pfSelect.selectAllSelector,function(evt){selectAllRows(dt,evt.target.checked)}),$(dt.table().container()).on("click",ctx._pfSelect.selector,function(evt){"multi"!==style||"multi+shift"!==style?syncSelectCheckboxes(dt):syncSelectAllCheckbox(dt)})),dt.table().on("draw.dt",function(){syncSelectCheckboxes(dt)}),updateSelectedRowsText(dt)},DataTable.Api.register("pfSelect.selectAllRows()",function(select){return this.iterator("table",function(ctx){selectAllRows(new DataTable.Api(ctx),select)})}),$(document).on("preInit.dt.dtSelect",function(e,ctx){"dt"===e.namespace&&DataTable.pfSelect.init(new DataTable.Api(ctx))}),DataTable.pfSelect});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy