From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A4FC4332F for ; Tue, 12 Dec 2023 21:57:26 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.9197.1702418244181144351 for ; Tue, 12 Dec 2023 13:57:25 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=YZQWwHCG; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: marlon.rodriguez-garcia@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 134CF9C279C; Tue, 12 Dec 2023 16:57:23 -0500 (EST) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id A-rbshxQkJ_q; Tue, 12 Dec 2023 16:57:19 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 6158A9C284E; Tue, 12 Dec 2023 16:57:19 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com 6158A9C284E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1702418239; bh=F2GHFRPrSBzd+iOZmsCwk5U99byhK1CMehxIylAa6ys=; h=From:To:Date:Message-Id:MIME-Version; b=YZQWwHCGaBFfk3aHBRMDfNARGZe+vyTqBzh1/4jACmz81WCGpmrdFbfqP5xE+ChOa +rmAmx7avPp0Vr/ueShn5Kf4PIM83RYMSzHWuJILc5BA9BtdwxtB3cAUCvXCAX9X0x r7X4HunQNOkoZqjT4+nAtLivlY4m0XWqDNJ0Y0ESN4ffO/tDT+mvtjmamhwJzKBe1+ vl4c5CXobpud2oZXPpWn1lHbpwgkHxXkvzBx982mNfqYK7tguVeFGLcohNJ3SdTs74 10zzjK7ht+k/k0sQzCqTSTN5dVB1zQFtXD1kaApcdUtlPqi5tc5BXHAUzc1quDO9QC 8Kg6gaLLW35kw== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id zKRvwMSS2iXE; Tue, 12 Dec 2023 16:57:18 -0500 (EST) Received: from savoirfairelinux.ht.home (modemcable141.201-58-74.mc.videotron.ca [74.58.201.141]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id DDBF39C279C; Tue, 12 Dec 2023 16:57:17 -0500 (EST) From: Marlon Rodriguez Garcia To: bitbake-devel@lists.openembedded.org, toaster@lists.yoctoproject.org Cc: Marlon Rodriguez Garcia Subject: [PATCH] toaster: Added dataTables library to include sorting and pagination for table element Date: Tue, 12 Dec 2023 16:57:13 -0500 Message-Id: <20231212215713.235263-1-marlon.rodriguez-garcia@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 12 Dec 2023 21:57:26 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/6088 Added jquery.dataTables to customize table rendering in section "Import eve= ntlogs". This library includes the following: sorting, pagination, search and CSS st= yles. Signed-off-by: Marlon Rodriguez Garcia --- .../static/css/jquery.dataTables-1.11.5.css | 482 + .../static/js/jquery.dataTables-1.11.5.js | 15336 ++++++++++++++++ .../templates/command_line_builds.html | 9 +- 3 files changed, 15826 insertions(+), 1 deletion(-) create mode 100644 lib/toaster/toastergui/static/css/jquery.dataTables-1.1= 1.5.css create mode 100644 lib/toaster/toastergui/static/js/jquery.dataTables-1.11= .5.js diff --git a/lib/toaster/toastergui/static/css/jquery.dataTables-1.11.5.css= b/lib/toaster/toastergui/static/css/jquery.dataTables-1.11.5.css new file mode 100644 index 00000000..46559651 --- /dev/null +++ b/lib/toaster/toastergui/static/css/jquery.dataTables-1.11.5.css @@ -0,0 +1,482 @@ +table.dataTable th.dt-left, +table.dataTable td.dt-left { + text-align: left; +} +table.dataTable th.dt-center, +table.dataTable td.dt-center, +table.dataTable td.dataTables_empty { + text-align: center; +} +table.dataTable th.dt-right, +table.dataTable td.dt-right { + text-align: right; +} +table.dataTable th.dt-justify, +table.dataTable td.dt-justify { + text-align: justify; +} +table.dataTable th.dt-nowrap, +table.dataTable td.dt-nowrap { + white-space: nowrap; +} +table.dataTable thead th.dt-head-left, +table.dataTable thead td.dt-head-left, +table.dataTable tfoot th.dt-head-left, +table.dataTable tfoot td.dt-head-left { + text-align: left; +} +table.dataTable thead th.dt-head-center, +table.dataTable thead td.dt-head-center, +table.dataTable tfoot th.dt-head-center, +table.dataTable tfoot td.dt-head-center { + text-align: center; +} +table.dataTable thead th.dt-head-right, +table.dataTable thead td.dt-head-right, +table.dataTable tfoot th.dt-head-right, +table.dataTable tfoot td.dt-head-right { + text-align: right; +} +table.dataTable thead th.dt-head-justify, +table.dataTable thead td.dt-head-justify, +table.dataTable tfoot th.dt-head-justify, +table.dataTable tfoot td.dt-head-justify { + text-align: justify; +} +table.dataTable thead th.dt-head-nowrap, +table.dataTable thead td.dt-head-nowrap, +table.dataTable tfoot th.dt-head-nowrap, +table.dataTable tfoot td.dt-head-nowrap { + white-space: nowrap; +} +table.dataTable tbody th.dt-body-left, +table.dataTable tbody td.dt-body-left { + text-align: left; +} +table.dataTable tbody th.dt-body-center, +table.dataTable tbody td.dt-body-center { + text-align: center; +} +table.dataTable tbody th.dt-body-right, +table.dataTable tbody td.dt-body-right { + text-align: right; +} +table.dataTable tbody th.dt-body-justify, +table.dataTable tbody td.dt-body-justify { + text-align: justify; +} +table.dataTable tbody th.dt-body-nowrap, +table.dataTable tbody td.dt-body-nowrap { + white-space: nowrap; +} +table.dataTable td.dt-control { + text-align: center; + cursor: pointer; +} +table.dataTable td.dt-control:before { + height: 1em; + width: 1em; + margin-top: -9px; + display: inline-block; + color: white; + border: 0.15em solid white; + border-radius: 1em; + box-shadow: 0 0 0.2em #444; + box-sizing: content-box; + text-align: center; + text-indent: 0 !important; + font-family: "Courier New", Courier, monospace; + line-height: 1em; + content: "+"; + background-color: #31b131; +} +table.dataTable tr.dt-hasChild td.dt-control:before { + content: "-"; + background-color: #d33333; +} + +/* + * Table styles + */ +table.dataTable { + width: 100%; + margin: 0 auto; + clear: both; + border-collapse: separate; + border-spacing: 0; + /* + * Header and footer styles + */ + /* + * Body styles + */ +} +table.dataTable thead th, +table.dataTable tfoot th { + font-weight: bold; +} +table.dataTable thead th, +table.dataTable thead td { + padding: 10px 18px; + border-bottom: 1px solid #111; +} +table.dataTable thead th:active, +table.dataTable thead td:active { + outline: none; +} +table.dataTable tfoot th, +table.dataTable tfoot td { + padding: 10px 18px 6px 18px; + border-top: 1px solid #111; +} +table.dataTable thead .sorting, +table.dataTable thead .sorting_asc, +table.dataTable thead .sorting_desc, +table.dataTable thead .sorting_asc_disabled, +table.dataTable thead .sorting_desc_disabled { + cursor: pointer; + *cursor: hand; + background-repeat: no-repeat; + background-position: center right; +} +table.dataTable thead .sorting { + background-image: url("../images/sort_both.png"); +} +table.dataTable thead .sorting_asc { + background-image: url("../images/sort_asc.png") !important; +} +table.dataTable thead .sorting_desc { + background-image: url("../images/sort_desc.png") !important; +} +table.dataTable thead .sorting_asc_disabled { + background-image: url("../images/sort_asc_disabled.png"); +} +table.dataTable thead .sorting_desc_disabled { + background-image: url("../images/sort_desc_disabled.png"); +} +table.dataTable tbody tr { + background-color: #ffffff; +} +table.dataTable tbody tr.selected { + background-color: #B0BED9; +} +table.dataTable tbody th, +table.dataTable tbody td { + padding: 8px 10px; +} +table.dataTable.row-border tbody th, table.dataTable.row-border tbody td, = table.dataTable.display tbody th, table.dataTable.display tbody td { + border-top: 1px solid #ddd; +} +table.dataTable.row-border tbody tr:first-child th, +table.dataTable.row-border tbody tr:first-child td, table.dataTable.displa= y tbody tr:first-child th, +table.dataTable.display tbody tr:first-child td { + border-top: none; +} +table.dataTable.cell-border tbody th, table.dataTable.cell-border tbody td= { + border-top: 1px solid #ddd; + border-right: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr th:first-child, +table.dataTable.cell-border tbody tr td:first-child { + border-left: 1px solid #ddd; +} +table.dataTable.cell-border tbody tr:first-child th, +table.dataTable.cell-border tbody tr:first-child td { + border-top: none; +} +table.dataTable.stripe tbody tr.odd, table.dataTable.display tbody tr.odd { + background-color: #f9f9f9; +} +table.dataTable.stripe tbody tr.odd.selected, table.dataTable.display tbod= y tr.odd.selected { + background-color: #acbad4; +} +table.dataTable.hover tbody tr:hover, table.dataTable.display tbody tr:hov= er { + background-color: #f6f6f6; +} +table.dataTable.hover tbody tr:hover.selected, table.dataTable.display tbo= dy tr:hover.selected { + background-color: #aab7d1; +} +table.dataTable.order-column tbody tr > .sorting_1, +table.dataTable.order-column tbody tr > .sorting_2, +table.dataTable.order-column tbody tr > .sorting_3, table.dataTable.displa= y tbody tr > .sorting_1, +table.dataTable.display tbody tr > .sorting_2, +table.dataTable.display tbody tr > .sorting_3 { + background-color: #fafafa; +} +table.dataTable.order-column tbody tr.selected > .sorting_1, +table.dataTable.order-column tbody tr.selected > .sorting_2, +table.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTab= le.display tbody tr.selected > .sorting_1, +table.dataTable.display tbody tr.selected > .sorting_2, +table.dataTable.display tbody tr.selected > .sorting_3 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-c= olumn.stripe tbody tr.odd > .sorting_1 { + background-color: #f1f1f1; +} +table.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-c= olumn.stripe tbody tr.odd > .sorting_2 { + background-color: #f3f3f3; +} +table.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-c= olumn.stripe tbody tr.odd > .sorting_3 { + background-color: whitesmoke; +} +table.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTabl= e.order-column.stripe tbody tr.odd.selected > .sorting_1 { + background-color: #a6b4cd; +} +table.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTabl= e.order-column.stripe tbody tr.odd.selected > .sorting_2 { + background-color: #a8b5cf; +} +table.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTabl= e.order-column.stripe tbody tr.odd.selected > .sorting_3 { + background-color: #a9b7d1; +} +table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-= column.stripe tbody tr.even > .sorting_1 { + background-color: #fafafa; +} +table.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-= column.stripe tbody tr.even > .sorting_2 { + background-color: #fcfcfc; +} +table.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-= column.stripe tbody tr.even > .sorting_3 { + background-color: #fefefe; +} +table.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTab= le.order-column.stripe tbody tr.even.selected > .sorting_1 { + background-color: #acbad5; +} +table.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTab= le.order-column.stripe tbody tr.even.selected > .sorting_2 { + background-color: #aebcd6; +} +table.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTab= le.order-column.stripe tbody tr.even.selected > .sorting_3 { + background-color: #afbdd8; +} +table.dataTable.display tbody tr:hover > .sorting_1, table.dataTable.order= -column.hover tbody tr:hover > .sorting_1 { + background-color: #eaeaea; +} +table.dataTable.display tbody tr:hover > .sorting_2, table.dataTable.order= -column.hover tbody tr:hover > .sorting_2 { + background-color: #ececec; +} +table.dataTable.display tbody tr:hover > .sorting_3, table.dataTable.order= -column.hover tbody tr:hover > .sorting_3 { + background-color: #efefef; +} +table.dataTable.display tbody tr:hover.selected > .sorting_1, table.dataTa= ble.order-column.hover tbody tr:hover.selected > .sorting_1 { + background-color: #a2aec7; +} +table.dataTable.display tbody tr:hover.selected > .sorting_2, table.dataTa= ble.order-column.hover tbody tr:hover.selected > .sorting_2 { + background-color: #a3b0c9; +} +table.dataTable.display tbody tr:hover.selected > .sorting_3, table.dataTa= ble.order-column.hover tbody tr:hover.selected > .sorting_3 { + background-color: #a5b2cb; +} +table.dataTable.no-footer { + border-bottom: 1px solid #111; +} +table.dataTable.nowrap th, table.dataTable.nowrap td { + white-space: nowrap; +} +table.dataTable.compact thead th, +table.dataTable.compact thead td { + padding: 4px 17px; +} +table.dataTable.compact tfoot th, +table.dataTable.compact tfoot td { + padding: 4px; +} +table.dataTable.compact tbody th, +table.dataTable.compact tbody td { + padding: 4px; +} + +table.dataTable th, +table.dataTable td { + box-sizing: content-box; +} + +/* + * Control feature layout + */ +.dataTables_wrapper { + position: relative; + clear: both; +} +.dataTables_wrapper .dataTables_length { + float: left; +} +.dataTables_wrapper .dataTables_length select { + border: 1px solid #aaa; + border-radius: 3px; + padding: 5px; + background-color: transparent; + padding: 4px; +} +.dataTables_wrapper .dataTables_filter { + float: right; + text-align: right; +} +.dataTables_wrapper .dataTables_filter input { + border: 1px solid #aaa; + border-radius: 3px; + padding: 5px; + background-color: transparent; + margin-left: 3px; +} +.dataTables_wrapper .dataTables_info { + clear: both; + float: left; + padding-top: 0.755em; +} +.dataTables_wrapper .dataTables_paginate { + float: right; + text-align: right; + padding-top: 0.25em; +} +.dataTables_wrapper .dataTables_paginate .paginate_button { + box-sizing: border-box; + display: inline-block; + min-width: 1.5em; + padding: 0.5em 1em; + margin-left: 2px; + text-align: center; + text-decoration: none !important; + cursor: pointer; + *cursor: hand; + color: #333 !important; + border: 1px solid transparent; + border-radius: 2px; +} +.dataTables_wrapper .dataTables_paginate .paginate_button.current, .dataTa= bles_wrapper .dataTables_paginate .paginate_button.current:hover { + color: #333 !important; + border: 1px solid #979797; + background-color: white; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0= %, white), color-stop(100%, #dcdcdc)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, white 0%, #dcdcdc 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, white 0%, #dcdcdc 100%); + /* IE10+ */ + background: -o-linear-gradient(top, white 0%, #dcdcdc 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, white 0%, #dcdcdc 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button.disabled, .dataT= ables_wrapper .dataTables_paginate .paginate_button.disabled:hover, .dataTa= bles_wrapper .dataTables_paginate .paginate_button.disabled:active { + cursor: default; + color: #666 !important; + border: 1px solid transparent; + background: transparent; + box-shadow: none; +} +.dataTables_wrapper .dataTables_paginate .paginate_button:hover { + color: white !important; + border: 1px solid #111; + background-color: #585858; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0= %, #585858), color-stop(100%, #111)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #585858 0%, #111 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #585858 0%, #111 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #585858 0%, #111 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #585858 0%, #111 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #585858 0%, #111 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_paginate .paginate_button:active { + outline: none; + background-color: #2b2b2b; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0= %, #2b2b2b), color-stop(100%, #0c0c0c)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* IE10+ */ + background: -o-linear-gradient(top, #2b2b2b 0%, #0c0c0c 100%); + /* Opera 11.10+ */ + background: linear-gradient(to bottom, #2b2b2b 0%, #0c0c0c 100%); + /* W3C */ + box-shadow: inset 0 0 3px #111; +} +.dataTables_wrapper .dataTables_paginate .ellipsis { + padding: 0 1em; +} +.dataTables_wrapper .dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 100%; + height: 40px; + margin-left: -50%; + margin-top: -25px; + padding-top: 20px; + text-align: center; + font-size: 1.2em; + background-color: white; + background: -webkit-gradient(linear, left top, right top, color-stop(0%,= rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-= stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0= ))); + background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgb= a(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255= , 0) 100%); + background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(2= 55, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0= ) 100%); + background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(25= 5, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0)= 100%); + background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255= , 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) = 100%); + background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(25= 5, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0)= 100%); +} +.dataTables_wrapper .dataTables_length, +.dataTables_wrapper .dataTables_filter, +.dataTables_wrapper .dataTables_info, +.dataTables_wrapper .dataTables_processing, +.dataTables_wrapper .dataTables_paginate { + color: #333; +} +.dataTables_wrapper .dataTables_scroll { + clear: both; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody { + *margin-top: -1px; + -webkit-overflow-scrolling: touch; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table >= thead > tr > th, .dataTables_wrapper .dataTables_scroll div.dataTables_scr= ollBody > table > thead > tr > td, .dataTables_wrapper .dataTables_scroll d= iv.dataTables_scrollBody > table > tbody > tr > th, .dataTables_wrapper .da= taTables_scroll div.dataTables_scrollBody > table > tbody > tr > td { + vertical-align: middle; +} +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table >= thead > tr > th > div.dataTables_sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table >= thead > tr > td > div.dataTables_sizing, .dataTables_wrapper .dataTables_s= croll div.dataTables_scrollBody > table > tbody > tr > th > div.dataTables_= sizing, +.dataTables_wrapper .dataTables_scroll div.dataTables_scrollBody > table >= tbody > tr > td > div.dataTables_sizing { + height: 0; + overflow: hidden; + margin: 0 !important; + padding: 0 !important; +} +.dataTables_wrapper.no-footer .dataTables_scrollBody { + border-bottom: 1px solid #111; +} +.dataTables_wrapper.no-footer div.dataTables_scrollHead table.dataTable, +.dataTables_wrapper.no-footer div.dataTables_scrollBody > table { + border-bottom: none; +} +.dataTables_wrapper:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; +} + +@media screen and (max-width: 767px) { + .dataTables_wrapper .dataTables_info, +.dataTables_wrapper .dataTables_paginate { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_paginate { + margin-top: 0.5em; + } +} +@media screen and (max-width: 640px) { + .dataTables_wrapper .dataTables_length, +.dataTables_wrapper .dataTables_filter { + float: none; + text-align: center; + } + .dataTables_wrapper .dataTables_filter { + margin-top: 0.5em; + } +} diff --git a/lib/toaster/toastergui/static/js/jquery.dataTables-1.11.5.js b= /lib/toaster/toastergui/static/js/jquery.dataTables-1.11.5.js new file mode 100644 index 00000000..b1d556aa --- /dev/null +++ b/lib/toaster/toastergui/static/js/jquery.dataTables-1.11.5.js @@ -0,0 +1,15336 @@ +/*! DataTables 1.11.5 + * =C2=A92008-2021 SpryMedia Ltd - datatables.net/license + */ + +/** + * @summary DataTables + * @description Paginate, search and order HTML tables + * @version 1.11.5 + * @file jquery.dataTables.js + * @author SpryMedia Ltd + * @contact www.datatables.net + * @copyright Copyright 2008-2021 SpryMedia Ltd. + * + * This source file is free software, available under the following licens= e: + * MIT license - http://datatables.net/license + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL= ITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + * + * For details please refer to: http://www.datatables.net + */ + +/*jslint evil: true, undef: true, browser: true */ +/*globals $,require,jQuery,define,_selector_run,_selector_opts,_selector_f= irst,_selector_row_indexes,_ext,_Api,_api_register,_api_registerPlural,_re_= new_lines,_re_html,_re_formatted_numeric,_re_escape_regex,_empty,_intVal,_n= umToDecimal,_isNumber,_isHtml,_htmlNumeric,_pluck,_pluck_order,_range,_stri= pHtml,_unique,_fnBuildAjax,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDra= w,_fnAjaxDataSrc,_fnAddColumn,_fnColumnOptions,_fnAdjustColumnSizing,_fnVis= ibleToColumnIndex,_fnColumnIndexToVisible,_fnVisbleColumns,_fnGetColumns,_f= nColumnTypes,_fnApplyColumnDefs,_fnHungarianMap,_fnCamelToHungarian,_fnLang= uageCompat,_fnBrowserDetect,_fnAddData,_fnAddTr,_fnNodeToDataIndex,_fnNodeT= oColumnIndex,_fnGetCellData,_fnSetCellData,_fnSplitObjNotation,_fnGetObject= DataFn,_fnSetObjectDataFn,_fnGetDataMaster,_fnClearTable,_fnDeleteIndex,_fn= Invalidate,_fnGetRowElements,_fnCreateTr,_fnBuildHead,_fnDrawHead,_fnDraw,_= fnReDraw,_fnAddOptionsHtml,_fnDetectHeader,_fnGetUniqueThs,_fnFeatureHtmlFi= lter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnFilterC= reateSearch,_fnEscapeRegex,_fnFilterData,_fnFeatureHtmlInfo,_fnUpdateInfo,_= fnInfoMacros,_fnInitialise,_fnInitComplete,_fnLengthChange,_fnFeatureHtmlLe= ngth,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlProcessing,_fnProce= ssingDisplay,_fnFeatureHtmlTable,_fnScrollDraw,_fnApplyToChildren,_fnCalcul= ateColumnWidths,_fnThrottle,_fnConvertToWidth,_fnGetWidestNode,_fnGetMaxLen= String,_fnStringToCss,_fnSortFlatten,_fnSort,_fnSortAria,_fnSortListener,_f= nSortAttachListener,_fnSortingClasses,_fnSortData,_fnSaveState,_fnLoadState= ,_fnSettingsFromNode,_fnLog,_fnMap,_fnBindAction,_fnCallbackReg,_fnCallback= Fire,_fnLengthOverflow,_fnRenderer,_fnDataSource,_fnRowAttributes*/ + +(function( factory ) { + "use strict"; + + if ( typeof define =3D=3D=3D 'function' && define.amd ) { + // AMD + define( ['jquery'], function ( $ ) { + return factory( $, window, document ); + } ); + } + else if ( typeof exports =3D=3D=3D 'object' ) { + // CommonJS + module.exports =3D function (root, $) { + if ( ! root ) { + // CommonJS environments without a window global must pass a + // root. This will give an error otherwise + root =3D window; + } + + if ( ! $ ) { + $ =3D typeof window !=3D=3D 'undefined' ? // jQuery's factory checks f= or a global window + require('jquery') : + require('jquery')( root ); + } + + return factory( $, root, root.document ); + }; + } + else { + // Browser + window.DataTable =3D factory( jQuery, window, document ); + } +} +(function( $, window, document, undefined ) { + "use strict"; + +=09 + var DataTable =3D function ( selector, options ) + { + // When creating with `new`, create a new DataTable, returning the API i= nstance + if (this instanceof DataTable) { + return $(selector).DataTable(options); + } + else { + // Argument switching + options =3D selector; + } +=09 + /** + * Perform a jQuery selector action on the table's TR elements (from the= tbody) and + * return the resulting jQuery object. + * @param {string|node|jQuery} sSelector jQuery selector or node collec= tion to act on + * @param {object} [oOpts] Optional parameters for modifying the rows t= o be included + * @param {string} [oOpts.filter=3Dnone] Select TR elements that meet t= he current filter + * criterion ("applied") or all TR elements (i.e. no filter). + * @param {string} [oOpts.order=3Dcurrent] Order of the TR elements in = the processed array. + * Can be either 'current', whereby the current sorting of the table = is used, or + * 'original' whereby the original order the data was read into the t= able is used. + * @param {string} [oOpts.page=3Dall] Limit the selection to the curren= tly displayed page + * ("current") or not ("all"). If 'current' is given, then order is a= ssumed to be + * 'current' and filter is 'applied', regardless of what they might b= e given as. + * @returns {object} jQuery object, filtered by the given selector. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Highlight every second row + * oTable.$('tr:odd').css('backgroundColor', 'blue'); + * } ); + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Filter to rows with 'Webkit' in them, add a background colour= and then + * // remove the filter, thus highlighting the 'Webkit' rows only. + * oTable.fnFilter('Webkit'); + * oTable.$('tr', {"search": "applied"}).css('backgroundColor', 'bl= ue'); + * oTable.fnFilter(''); + * } ); + */ + this.$ =3D function ( sSelector, oOpts ) + { + return this.api(true).$( sSelector, oOpts ); + }; +=09=09 +=09=09 + /** + * Almost identical to $ in operation, but in this case returns the data= for the matched + * rows - as such, the jQuery selector used should match TR row nodes or= TD/TH cell nodes + * rather than any descendants, so the data can be obtained for the row/= cell. If matching + * rows are found, the data returned is the original data array/object t= hat was used to + * create the row (or a generated array if from a DOM source). + * + * This method is often useful in-combination with $ where both function= s are given the + * same parameters and the array indexes will match identically. + * @param {string|node|jQuery} sSelector jQuery selector or node collec= tion to act on + * @param {object} [oOpts] Optional parameters for modifying the rows t= o be included + * @param {string} [oOpts.filter=3Dnone] Select elements that meet the = current filter + * criterion ("applied") or all elements (i.e. no filter). + * @param {string} [oOpts.order=3Dcurrent] Order of the data in the pro= cessed array. + * Can be either 'current', whereby the current sorting of the table = is used, or + * 'original' whereby the original order the data was read into the t= able is used. + * @param {string} [oOpts.page=3Dall] Limit the selection to the curren= tly displayed page + * ("current") or not ("all"). If 'current' is given, then order is a= ssumed to be + * 'current' and filter is 'applied', regardless of what they might b= e given as. + * @returns {array} Data for the matched elements. If any elements, as = a result of the + * selector, were not TR, TD or TH elements in the DataTable, they wi= ll have a null + * entry in the array. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Get the data from the first row in the table + * var data =3D oTable._('tr:first'); + * + * // Do something useful with the data + * alert( "First cell is: "+data[0] ); + * } ); + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Filter to 'Webkit' and get all data for + * oTable.fnFilter('Webkit'); + * var data =3D oTable._('tr', {"search": "applied"}); + * + * // Do something with the data + * alert( data.length+" rows matched the search" ); + * } ); + */ + this._ =3D function ( sSelector, oOpts ) + { + return this.api(true).rows( sSelector, oOpts ).data(); + }; +=09=09 +=09=09 + /** + * Create a DataTables Api instance, with the currently selected tables = for + * the Api's context. + * @param {boolean} [traditional=3Dfalse] Set the API instance's context= to be + * only the table referred to by the `DataTable.ext.iApiIndex` option,= as was + * used in the API presented by DataTables 1.9- (i.e. the traditional = mode), + * or if all tables captured in the jQuery object should be used. + * @return {DataTables.Api} + */ + this.api =3D function ( traditional ) + { + return traditional ? + new _Api( + _fnSettingsFromNode( this[ _ext.iApiIndex ] ) + ) : + new _Api( this ); + }; +=09=09 +=09=09 + /** + * Add a single new row or multiple rows of data to the table. Please no= te + * that this is suitable for client-side processing only - if you are us= ing + * server-side processing (i.e. "bServerSide": true), then to add data, = you + * must add it to the data source, i.e. the server-side, through an Ajax= call. + * @param {array|object} data The data to be added to the table. This c= an be: + *
    + *
  • 1D array of data - add a single row with the data provided + *
  • 2D array of arrays - add multiple rows in a single call
  • + *
  • object - data object when using mData
  • + *
  • array of objects - multiple data objects when using mData=
  • + *
+ * @param {bool} [redraw=3Dtrue] redraw the table or not + * @returns {array} An array of integers, representing the list of inde= xes in + * aoData ({@link DataTable.models.oSettings}) that have been = added to + * the table. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * // Global var for counter + * var giCount =3D 2; + * + * $(document).ready(function() { + * $('#example').dataTable(); + * } ); + * + * function fnClickAddRow() { + * $('#example').dataTable().fnAddData( [ + * giCount+".1", + * giCount+".2", + * giCount+".3", + * giCount+".4" ] + * ); + * + * giCount++; + * } + */ + this.fnAddData =3D function( data, redraw ) + { + var api =3D this.api( true ); +=09=09 + /* Check if we want to add multiple rows or not */ + var rows =3D Array.isArray(data) && ( Array.isArray(data[0]) || $.isPla= inObject(data[0]) ) ? + api.rows.add( data ) : + api.row.add( data ); +=09=09 + if ( redraw =3D=3D=3D undefined || redraw ) { + api.draw(); + } +=09=09 + return rows.flatten().toArray(); + }; +=09=09 +=09=09 + /** + * This function will make DataTables recalculate the column sizes, base= d on the data + * contained in the table and the sizes applied to the columns (in the D= OM, CSS or + * through the sWidth parameter). This can be useful when the width of t= he table's + * parent element changes (for example a window resize). + * @param {boolean} [bRedraw=3Dtrue] Redraw the table or not, you will = typically want to + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable( { + * "sScrollY": "200px", + * "bPaginate": false + * } ); + * + * $(window).on('resize', function () { + * oTable.fnAdjustColumnSizing(); + * } ); + * } ); + */ + this.fnAdjustColumnSizing =3D function ( bRedraw ) + { + var api =3D this.api( true ).columns.adjust(); + var settings =3D api.settings()[0]; + var scroll =3D settings.oScroll; +=09=09 + if ( bRedraw =3D=3D=3D undefined || bRedraw ) { + api.draw( false ); + } + else if ( scroll.sX !=3D=3D "" || scroll.sY !=3D=3D "" ) { + /* If not redrawing, but scrolling, we want to apply the new column si= zes anyway */ + _fnScrollDraw( settings ); + } + }; +=09=09 +=09=09 + /** + * Quickly and simply clear a table + * @param {bool} [bRedraw=3Dtrue] redraw the table or not + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Immediately 'nuke' the current rows (perhaps waiting for an A= jax callback...) + * oTable.fnClearTable(); + * } ); + */ + this.fnClearTable =3D function( bRedraw ) + { + var api =3D this.api( true ).clear(); +=09=09 + if ( bRedraw =3D=3D=3D undefined || bRedraw ) { + api.draw(); + } + }; +=09=09 +=09=09 + /** + * The exact opposite of 'opening' a row, this function will close any r= ows which + * are currently 'open'. + * @param {node} nTr the table row to 'close' + * @returns {int} 0 on success, or 1 if failed (can't find the row) + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable; + * + * // 'open' an information row when a row is clicked on + * $('#example tbody tr').click( function () { + * if ( oTable.fnIsOpen(this) ) { + * oTable.fnClose( this ); + * } else { + * oTable.fnOpen( this, "Temporary row opened", "info_row" ); + * } + * } ); + * + * oTable =3D $('#example').dataTable(); + * } ); + */ + this.fnClose =3D function( nTr ) + { + this.api( true ).row( nTr ).child.hide(); + }; +=09=09 +=09=09 + /** + * Remove a row for the table + * @param {mixed} target The index of the row from aoData to be deleted= , or + * the TR element you want to delete + * @param {function|null} [callBack] Callback function + * @param {bool} [redraw=3Dtrue] Redraw the table or not + * @returns {array} The row that was deleted + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Immediately remove the first row + * oTable.fnDeleteRow( 0 ); + * } ); + */ + this.fnDeleteRow =3D function( target, callback, redraw ) + { + var api =3D this.api( true ); + var rows =3D api.rows( target ); + var settings =3D rows.settings()[0]; + var data =3D settings.aoData[ rows[0][0] ]; +=09=09 + rows.remove(); +=09=09 + if ( callback ) { + callback.call( this, settings, data ); + } +=09=09 + if ( redraw =3D=3D=3D undefined || redraw ) { + api.draw(); + } +=09=09 + return data; + }; +=09=09 +=09=09 + /** + * Restore the table to it's original state in the DOM by removing all o= f DataTables + * enhancements, alterations to the DOM structure of the table and event= listeners. + * @param {boolean} [remove=3Dfalse] Completely remove the table from t= he DOM + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * // This example is fairly pointless in reality, but shows how fn= Destroy can be used + * var oTable =3D $('#example').dataTable(); + * oTable.fnDestroy(); + * } ); + */ + this.fnDestroy =3D function ( remove ) + { + this.api( true ).destroy( remove ); + }; +=09=09 +=09=09 + /** + * Redraw the table + * @param {bool} [complete=3Dtrue] Re-filter and resort (if enabled) th= e table before the draw. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Re-draw the table - you wouldn't want to do it here, but it's= an example :-) + * oTable.fnDraw(); + * } ); + */ + this.fnDraw =3D function( complete ) + { + // Note that this isn't an exact match to the old call to _fnDraw - it = takes + // into account the new data, but can hold position. + this.api( true ).draw( complete ); + }; +=09=09 +=09=09 + /** + * Filter the input based on data + * @param {string} sInput String to filter the table on + * @param {int|null} [iColumn] Column to limit filtering to + * @param {bool} [bRegex=3Dfalse] Treat as regular expression or not + * @param {bool} [bSmart=3Dtrue] Perform smart filtering or not + * @param {bool} [bShowGlobal=3Dtrue] Show the input global filter in i= t's input box(es) + * @param {bool} [bCaseInsensitive=3Dtrue] Do case-insensitive matching= (true) or not (false) + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Sometime later - filter... + * oTable.fnFilter( 'test string' ); + * } ); + */ + this.fnFilter =3D function( sInput, iColumn, bRegex, bSmart, bShowGlobal= , bCaseInsensitive ) + { + var api =3D this.api( true ); +=09=09 + if ( iColumn =3D=3D=3D null || iColumn =3D=3D=3D undefined ) { + api.search( sInput, bRegex, bSmart, bCaseInsensitive ); + } + else { + api.column( iColumn ).search( sInput, bRegex, bSmart, bCaseInsensitive= ); + } +=09=09 + api.draw(); + }; +=09=09 +=09=09 + /** + * Get the data for the whole table, an individual row or an individual = cell based on the + * provided parameters. + * @param {int|node} [src] A TR row node, TD/TH cell node or an integer= . If given as + * a TR node then the data source for the whole row will be returned.= If given as a + * TD/TH cell node then iCol will be automatically calculated and the= data for the + * cell returned. If given as an integer, then this is treated as the= aoData internal + * data index for the row (see fnGetPosition) and the data for that r= ow used. + * @param {int} [col] Optional column index that you want the data of. + * @returns {array|object|string} If mRow is undefined, then the data f= or all rows is + * returned. If mRow is defined, just data for that row, and is iCol = is + * defined, only data for the designated cell is returned. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * // Row data + * $(document).ready(function() { + * oTable =3D $('#example').dataTable(); + * + * oTable.$('tr').click( function () { + * var data =3D oTable.fnGetData( this ); + * // ... do something with the array / object of data for the row + * } ); + * } ); + * + * @example + * // Individual cell data + * $(document).ready(function() { + * oTable =3D $('#example').dataTable(); + * + * oTable.$('td').click( function () { + * var sData =3D oTable.fnGetData( this ); + * alert( 'The cell clicked on had the value of '+sData ); + * } ); + * } ); + */ + this.fnGetData =3D function( src, col ) + { + var api =3D this.api( true ); +=09=09 + if ( src !=3D=3D undefined ) { + var type =3D src.nodeName ? src.nodeName.toLowerCase() : ''; +=09=09 + return col !=3D=3D undefined || type =3D=3D 'td' || type =3D=3D 'th' ? + api.cell( src, col ).data() : + api.row( src ).data() || null; + } +=09=09 + return api.data().toArray(); + }; +=09=09 +=09=09 + /** + * Get an array of the TR nodes that are used in the table's body. Note = that you will + * typically want to use the '$' API method in preference to this as it = is more + * flexible. + * @param {int} [iRow] Optional row index for the TR element you want + * @returns {array|node} If iRow is undefined, returns an array of all = TR elements + * in the table's body, or iRow is defined, just the TR element reque= sted. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Get the nodes from the table + * var nNodes =3D oTable.fnGetNodes( ); + * } ); + */ + this.fnGetNodes =3D function( iRow ) + { + var api =3D this.api( true ); +=09=09 + return iRow !=3D=3D undefined ? + api.row( iRow ).node() : + api.rows().nodes().flatten().toArray(); + }; +=09=09 +=09=09 + /** + * Get the array indexes of a particular cell from it's DOM element + * and column index including hidden columns + * @param {node} node this can either be a TR, TD or TH in the table's = body + * @returns {int} If nNode is given as a TR, then a single index is ret= urned, or + * if given as a cell, an array of [row index, column index (visible), + * column index (all)] is given. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * $('#example tbody td').click( function () { + * // Get the position of the current data from the node + * var aPos =3D oTable.fnGetPosition( this ); + * + * // Get the data array for this row + * var aData =3D oTable.fnGetData( aPos[0] ); + * + * // Update the data array and return the value + * aData[ aPos[1] ] =3D 'clicked'; + * this.innerHTML =3D 'clicked'; + * } ); + * + * // Init DataTables + * oTable =3D $('#example').dataTable(); + * } ); + */ + this.fnGetPosition =3D function( node ) + { + var api =3D this.api( true ); + var nodeName =3D node.nodeName.toUpperCase(); +=09=09 + if ( nodeName =3D=3D 'TR' ) { + return api.row( node ).index(); + } + else if ( nodeName =3D=3D 'TD' || nodeName =3D=3D 'TH' ) { + var cell =3D api.cell( node ).index(); +=09=09 + return [ + cell.row, + cell.columnVisible, + cell.column + ]; + } + return null; + }; +=09=09 +=09=09 + /** + * Check to see if a row is 'open' or not. + * @param {node} nTr the table row to check + * @returns {boolean} true if the row is currently open, false otherwise + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable; + * + * // 'open' an information row when a row is clicked on + * $('#example tbody tr').click( function () { + * if ( oTable.fnIsOpen(this) ) { + * oTable.fnClose( this ); + * } else { + * oTable.fnOpen( this, "Temporary row opened", "info_row" ); + * } + * } ); + * + * oTable =3D $('#example').dataTable(); + * } ); + */ + this.fnIsOpen =3D function( nTr ) + { + return this.api( true ).row( nTr ).child.isShown(); + }; +=09=09 +=09=09 + /** + * This function will place a new row directly after a row which is curr= ently + * on display on the page, with the HTML contents that is passed into the + * function. This can be used, for example, to ask for confirmation that= a + * particular record should be deleted. + * @param {node} nTr The table row to 'open' + * @param {string|node|jQuery} mHtml The HTML to put into the row + * @param {string} sClass Class to give the new TD cell + * @returns {node} The row opened. Note that if the table row passed in= as the + * first parameter, is not found in the table, this method will silen= tly + * return. + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable; + * + * // 'open' an information row when a row is clicked on + * $('#example tbody tr').click( function () { + * if ( oTable.fnIsOpen(this) ) { + * oTable.fnClose( this ); + * } else { + * oTable.fnOpen( this, "Temporary row opened", "info_row" ); + * } + * } ); + * + * oTable =3D $('#example').dataTable(); + * } ); + */ + this.fnOpen =3D function( nTr, mHtml, sClass ) + { + return this.api( true ) + .row( nTr ) + .child( mHtml, sClass ) + .show() + .child()[0]; + }; +=09=09 +=09=09 + /** + * Change the pagination - provides the internal logic for pagination in= a simple API + * function. With this function you can have a DataTables table go to th= e next, + * previous, first or last pages. + * @param {string|int} mAction Paging action to take: "first", "previou= s", "next" or "last" + * or page number to jump to (integer), note that page 0 is the first= page. + * @param {bool} [bRedraw=3Dtrue] Redraw the table or not + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * oTable.fnPageChange( 'next' ); + * } ); + */ + this.fnPageChange =3D function ( mAction, bRedraw ) + { + var api =3D this.api( true ).page( mAction ); +=09=09 + if ( bRedraw =3D=3D=3D undefined || bRedraw ) { + api.draw(false); + } + }; +=09=09 +=09=09 + /** + * Show a particular column + * @param {int} iCol The column whose display should be changed + * @param {bool} bShow Show (true) or hide (false) the column + * @param {bool} [bRedraw=3Dtrue] Redraw the table or not + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Hide the second column after initialisation + * oTable.fnSetColumnVis( 1, false ); + * } ); + */ + this.fnSetColumnVis =3D function ( iCol, bShow, bRedraw ) + { + var api =3D this.api( true ).column( iCol ).visible( bShow ); +=09=09 + if ( bRedraw =3D=3D=3D undefined || bRedraw ) { + api.columns.adjust().draw(); + } + }; +=09=09 +=09=09 + /** + * Get the settings for a particular table for external manipulation + * @returns {object} DataTables settings object. See + * {@link DataTable.models.oSettings} + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * var oSettings =3D oTable.fnSettings(); + * + * // Show an example parameter from the settings + * alert( oSettings._iDisplayStart ); + * } ); + */ + this.fnSettings =3D function() + { + return _fnSettingsFromNode( this[_ext.iApiIndex] ); + }; +=09=09 +=09=09 + /** + * Sort the table by a particular column + * @param {int} iCol the data index to sort on. Note that this will not= match the + * 'display index' if you have hidden data entries + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Sort immediately with columns 0 and 1 + * oTable.fnSort( [ [0,'asc'], [1,'asc'] ] ); + * } ); + */ + this.fnSort =3D function( aaSort ) + { + this.api( true ).order( aaSort ).draw(); + }; +=09=09 +=09=09 + /** + * Attach a sort listener to an element for a given column + * @param {node} nNode the element to attach the sort listener to + * @param {int} iColumn the column that a click on this node will sort = on + * @param {function} [fnCallback] callback function when sort is run + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * + * // Sort on column 1, when 'sorter' is clicked on + * oTable.fnSortListener( document.getElementById('sorter'), 1 ); + * } ); + */ + this.fnSortListener =3D function( nNode, iColumn, fnCallback ) + { + this.api( true ).order.listener( nNode, iColumn, fnCallback ); + }; +=09=09 +=09=09 + /** + * Update a table cell or row - this method will accept either a single = value to + * update the cell with, an array of values with one element for each co= lumn or + * an object in the same format as the original data source. The functio= n is + * self-referencing in order to make the multi column updates easier. + * @param {object|array|string} mData Data to update the cell/row with + * @param {node|int} mRow TR element you want to update or the aoData i= ndex + * @param {int} [iColumn] The column to update, give as null or undefin= ed to + * update a whole row. + * @param {bool} [bRedraw=3Dtrue] Redraw the table or not + * @param {bool} [bAction=3Dtrue] Perform pre-draw actions or not + * @returns {int} 0 on success, 1 on error + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell + * oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], $('tbody tr')[0] ); = // Row + * } ); + */ + this.fnUpdate =3D function( mData, mRow, iColumn, bRedraw, bAction ) + { + var api =3D this.api( true ); +=09=09 + if ( iColumn =3D=3D=3D undefined || iColumn =3D=3D=3D null ) { + api.row( mRow ).data( mData ); + } + else { + api.cell( mRow, iColumn ).data( mData ); + } +=09=09 + if ( bAction =3D=3D=3D undefined || bAction ) { + api.columns.adjust(); + } +=09=09 + if ( bRedraw =3D=3D=3D undefined || bRedraw ) { + api.draw(); + } + return 0; + }; +=09=09 +=09=09 + /** + * Provide a common method for plug-ins to check the version of DataTabl= es being used, in order + * to ensure compatibility. + * @param {string} sVersion Version string to check for, in the format = "X.Y.Z". Note that the + * formats "X" and "X.Y" are also acceptable. + * @returns {boolean} true if this version of DataTables is greater or = equal to the required + * version, or false if this version of DataTales is not suitable + * @method + * @dtopt API + * @deprecated Since v1.10 + * + * @example + * $(document).ready(function() { + * var oTable =3D $('#example').dataTable(); + * alert( oTable.fnVersionCheck( '1.9.0' ) ); + * } ); + */ + this.fnVersionCheck =3D _ext.fnVersionCheck; +=09=09 +=09 + var _that =3D this; + var emptyInit =3D options =3D=3D=3D undefined; + var len =3D this.length; +=09 + if ( emptyInit ) { + options =3D {}; + } +=09 + this.oApi =3D this.internal =3D _ext.internal; +=09 + // Extend with old style plug-in API methods + for ( var fn in DataTable.ext.internal ) { + if ( fn ) { + this[fn] =3D _fnExternApiFunc(fn); + } + } +=09 + this.each(function() { + // For each initialisation we want to give it a clean initialisation + // object that can be bashed around + var o =3D {}; + var oInit =3D len > 1 ? // optimisation for single table case + _fnExtend( o, options, true ) : + options; +=09 + /*global oInit,_that,emptyInit*/ + var i=3D0, iLen, j, jLen, k, kLen; + var sId =3D this.getAttribute( 'id' ); + var bInitHandedOff =3D false; + var defaults =3D DataTable.defaults; + var $this =3D $(this); +=09=09=09 +=09=09=09 + /* Sanity check */ + if ( this.nodeName.toLowerCase() !=3D 'table' ) + { + _fnLog( null, 0, 'Non-table node initialisation ('+this.nodeName+')', = 2 ); + return; + } +=09=09=09 + /* Backwards compatibility for the defaults */ + _fnCompatOpts( defaults ); + _fnCompatCols( defaults.column ); +=09=09=09 + /* Convert the camel-case defaults to Hungarian */ + _fnCamelToHungarian( defaults, defaults, true ); + _fnCamelToHungarian( defaults.column, defaults.column, true ); +=09=09=09 + /* Setting up the initialisation object */ + _fnCamelToHungarian( defaults, $.extend( oInit, $this.data() ), true ); +=09=09=09 +=09=09=09 +=09=09=09 + /* Check to see if we are re-initialising a table */ + var allSettings =3D DataTable.settings; + for ( i=3D0, iLen=3DallSettings.length ; i').appendTo($this); + } + oSettings.nTHead =3D thead[0]; +=09=09=09 + var tbody =3D $this.children('tbody'); + if ( tbody.length =3D=3D=3D 0 ) { + tbody =3D $('').insertAfter(thead); + } + oSettings.nTBody =3D tbody[0]; +=09=09=09 + var tfoot =3D $this.children('tfoot'); + if ( tfoot.length =3D=3D=3D 0 && captions.length > 0 && (oSettings.oSc= roll.sX !=3D=3D "" || oSettings.oScroll.sY !=3D=3D "") ) { + // If we are a scrolling table, and no footer has been given, then we= need to create + // a tfoot element for the caption element to be appended to + tfoot =3D $('').appendTo($this); + } +=09=09=09 + if ( tfoot.length =3D=3D=3D 0 || tfoot.children().length =3D=3D=3D 0 )= { + $this.addClass( oClasses.sNoFooter ); + } + else if ( tfoot.length > 0 ) { + oSettings.nTFoot =3D tfoot[0]; + _fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot ); + } +=09=09=09 + /* Check if there is data passing into the constructor */ + if ( oInit.aaData ) { + for ( i=3D0 ; i/g; +=09 + // This is not strict ISO8601 - Date.parse() is quite lax, although + // implementations differ between browsers. + var _re_date =3D /^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:= \.]\d{2}([\.:]\d{2})?)?$/; +=09 + // Escape regular expression special characters + var _re_escape_regex =3D new RegExp( '(\\' + [ '/', '.', '*', '+', '?', '= |', '(', ')', '[', ']', '{', '}', '\\', '$', '^', '-' ].join('|\\') + ')', = 'g' ); +=09 + // http://en.wikipedia.org/wiki/Foreign_exchange_market + // - \u20BD - Russian ruble. + // - \u20a9 - South Korean Won + // - \u20BA - Turkish Lira + // - \u20B9 - Indian Rupee + // - R - Brazil (R$) and South Africa + // - fr - Swiss Franc + // - kr - Swedish krona, Norwegian krone and Danish krone + // - \u2009 is thin space and \u202F is narrow no-break space, both used = in many + // - =C9=83 - Bitcoin + // - =CE=9E - Ethereum + // standards as thousands separators. + var _re_formatted_numeric =3D /['\u00A0,$=C2=A3=E2=82=AC=C2=A5%\u2009\u20= 2F\u20BD\u20a9\u20BArfk=C9=83=CE=9E]/gi; +=09 +=09 + var _empty =3D function ( d ) { + return !d || d =3D=3D=3D true || d =3D=3D=3D '-' ? true : false; + }; +=09 +=09 + var _intVal =3D function ( s ) { + var integer =3D parseInt( s, 10 ); + return !isNaN(integer) && isFinite(s) ? integer : null; + }; +=09 + // Convert from a formatted number with characters other than `.` as the + // decimal place, to a Javascript number + var _numToDecimal =3D function ( num, decimalPoint ) { + // Cache created regular expressions for speed as this function is calle= d often + if ( ! _re_dic[ decimalPoint ] ) { + _re_dic[ decimalPoint ] =3D new RegExp( _fnEscapeRegex( decimalPoint ),= 'g' ); + } + return typeof num =3D=3D=3D 'string' && decimalPoint !=3D=3D '.' ? + num.replace( /\./g, '' ).replace( _re_dic[ decimalPoint ], '.' ) : + num; + }; +=09 +=09 + var _isNumber =3D function ( d, decimalPoint, formatted ) { + var strType =3D typeof d =3D=3D=3D 'string'; +=09 + // If empty return immediately so there must be a number if it is a + // formatted string (this stops the string "k", or "kr", etc being detec= ted + // as a formatted number for currency + if ( _empty( d ) ) { + return true; + } +=09 + if ( decimalPoint && strType ) { + d =3D _numToDecimal( d, decimalPoint ); + } +=09 + if ( formatted && strType ) { + d =3D d.replace( _re_formatted_numeric, '' ); + } +=09 + return !isNaN( parseFloat(d) ) && isFinite( d ); + }; +=09 +=09 + // A string without HTML in it can be considered to be HTML still + var _isHtml =3D function ( d ) { + return _empty( d ) || typeof d =3D=3D=3D 'string'; + }; +=09 +=09 + var _htmlNumeric =3D function ( d, decimalPoint, formatted ) { + if ( _empty( d ) ) { + return true; + } +=09 + var html =3D _isHtml( d ); + return ! html ? + null : + _isNumber( _stripHtml( d ), decimalPoint, formatted ) ? + true : + null; + }; +=09 +=09 + var _pluck =3D function ( a, prop, prop2 ) { + var out =3D []; + var i=3D0, ien=3Da.length; +=09 + // Could have the test in the loop for slightly smaller code, but speed + // is essential here + if ( prop2 !=3D=3D undefined ) { + for ( ; i') + .css( { + position: 'fixed', + top: 0, + left: $(window).scrollLeft()*-1, // allow for scrolling + height: 1, + width: 1, + overflow: 'hidden' + } ) + .append( + $('
') + .css( { + position: 'absolute', + top: 1, + left: 1, + width: 100, + overflow: 'scroll' + } ) + .append( + $('
') + .css( { + width: '100%', + height: 10 + } ) + ) + ) + .appendTo( 'body' ); +=09 + var outer =3D n.children(); + var inner =3D outer.children(); +=09 + // Numbers below, in order, are: + // inner.offsetWidth, inner.clientWidth, outer.offsetWidth, outer.clien= tWidth + // + // IE6 XP: 100 100 100 83 + // IE7 Vista: 100 100 100 83 + // IE 8+ Windows: 83 83 100 83 + // Evergreen Windows: 83 83 100 83 + // Evergreen Mac with scrollbars: 85 85 100 85 + // Evergreen Mac without scrollbars: 100 100 100 100 +=09 + // Get scrollbar width + browser.barWidth =3D outer[0].offsetWidth - outer[0].clientWidth; +=09 + // IE6/7 will oversize a width 100% element inside a scrolling element,= to + // include the width of the scrollbar, while other browsers ensure the = inner + // element is contained without forcing scrolling + browser.bScrollOversize =3D inner[0].offsetWidth =3D=3D=3D 100 && outer= [0].clientWidth !=3D=3D 100; +=09 + // In rtl text layout, some browsers (most, but not all) will place the + // scrollbar on the left, rather than the right. + browser.bScrollbarLeft =3D Math.round( inner.offset().left ) !=3D=3D 1; +=09 + // IE8- don't provide height and width for getBoundingClientRect + browser.bBounding =3D n[0].getBoundingClientRect().width ? true : false; +=09 + n.remove(); + } +=09 + $.extend( settings.oBrowser, DataTable.__browser ); + settings.oScroll.iBarWidth =3D DataTable.__browser.barWidth; + } +=09 +=09 + /** + * Array.prototype reduce[Right] method, used for browsers which don't su= pport + * JS 1.6. Done this way to reduce code size, since we iterate either way + * @param {object} settings dataTables settings object + * @memberof DataTable#oApi + */ + function _fnReduce ( that, fn, init, start, end, inc ) + { + var + i =3D start, + value, + isSet =3D false; +=09 + if ( init !=3D=3D undefined ) { + value =3D init; + isSet =3D true; + } +=09 + while ( i !=3D=3D end ) { + if ( ! that.hasOwnProperty(i) ) { + continue; + } +=09 + value =3D isSet ? + fn( value, that[i], i, that ) : + that[i]; +=09 + isSet =3D true; + i +=3D inc; + } +=09 + return value; + } +=09 + /** + * Add a column to the list used for the table with default values + * @param {object} oSettings dataTables settings object + * @param {node} nTh The th element for this column + * @memberof DataTable#oApi + */ + function _fnAddColumn( oSettings, nTh ) + { + // Add column to aoColumns array + var oDefaults =3D DataTable.defaults.column; + var iCol =3D oSettings.aoColumns.length; + var oCol =3D $.extend( {}, DataTable.models.oColumn, oDefaults, { + "nTh": nTh ? nTh : document.createElement('th'), + "sTitle": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.inne= rHTML : '', + "aDataSort": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol], + "mData": oDefaults.mData ? oDefaults.mData : iCol, + idx: iCol + } ); + oSettings.aoColumns.push( oCol ); +=09 + // Add search object for column specific search. Note that the `searchCo= ls[ iCol ]` + // passed into extend can be undefined. This allows the user to give a d= efault + // with only some of the parameters defined, and also not give a default + var searchCols =3D oSettings.aoPreSearchCols; + searchCols[ iCol ] =3D $.extend( {}, DataTable.models.oSearch, searchCol= s[ iCol ] ); +=09 + // Use the default column options function to initialise classes etc + _fnColumnOptions( oSettings, iCol, $(nTh).data() ); + } +=09 +=09 + /** + * Apply options for a column + * @param {object} oSettings dataTables settings object + * @param {int} iCol column index to consider + * @param {object} oOptions object with sType, bVisible and bSearchable = etc + * @memberof DataTable#oApi + */ + function _fnColumnOptions( oSettings, iCol, oOptions ) + { + var oCol =3D oSettings.aoColumns[ iCol ]; + var oClasses =3D oSettings.oClasses; + var th =3D $(oCol.nTh); +=09 + // Try to get width information from the DOM. We can't get it from CSS + // as we'd need to parse the CSS stylesheet. `width` option can override + if ( ! oCol.sWidthOrig ) { + // Width attribute + oCol.sWidthOrig =3D th.attr('width') || null; +=09 + // Style attribute + var t =3D (th.attr('style') || '').match(/width:\s*(\d+[pxem%]+)/); + if ( t ) { + oCol.sWidthOrig =3D t[1]; + } + } +=09 + /* User specified column options */ + if ( oOptions !=3D=3D undefined && oOptions !=3D=3D null ) + { + // Backwards compatibility + _fnCompatCols( oOptions ); +=09 + // Map camel case parameters to their Hungarian counterparts + _fnCamelToHungarian( DataTable.defaults.column, oOptions, true ); +=09 + /* Backwards compatibility for mDataProp */ + if ( oOptions.mDataProp !=3D=3D undefined && !oOptions.mData ) + { + oOptions.mData =3D oOptions.mDataProp; + } +=09 + if ( oOptions.sType ) + { + oCol._sManualType =3D oOptions.sType; + } +=09 + // `class` is a reserved word in Javascript, so we need to provide + // the ability to use a valid name for the camel case input + if ( oOptions.className && ! oOptions.sClass ) + { + oOptions.sClass =3D oOptions.className; + } + if ( oOptions.sClass ) { + th.addClass( oOptions.sClass ); + } +=09 + $.extend( oCol, oOptions ); + _fnMap( oCol, oOptions, "sWidth", "sWidthOrig" ); +=09 + /* iDataSort to be applied (backwards compatibility), but aDataSort wil= l take + * priority if defined + */ + if ( oOptions.iDataSort !=3D=3D undefined ) + { + oCol.aDataSort =3D [ oOptions.iDataSort ]; + } + _fnMap( oCol, oOptions, "aDataSort" ); + } +=09 + /* Cache the data get and set functions for speed */ + var mDataSrc =3D oCol.mData; + var mData =3D _fnGetObjectDataFn( mDataSrc ); + var mRender =3D oCol.mRender ? _fnGetObjectDataFn( oCol.mRender ) : null; +=09 + var attrTest =3D function( src ) { + return typeof src =3D=3D=3D 'string' && src.indexOf('@') !=3D=3D -1; + }; + oCol._bAttrSrc =3D $.isPlainObject( mDataSrc ) && ( + attrTest(mDataSrc.sort) || attrTest(mDataSrc.type) || attrTest(mDataSrc= .filter) + ); + oCol._setter =3D null; +=09 + oCol.fnGetData =3D function (rowData, type, meta) { + var innerData =3D mData( rowData, type, undefined, meta ); +=09 + return mRender && type ? + mRender( innerData, type, rowData, meta ) : + innerData; + }; + oCol.fnSetData =3D function ( rowData, val, meta ) { + return _fnSetObjectDataFn( mDataSrc )( rowData, val, meta ); + }; +=09 + // Indicate if DataTables should read DOM data as an object or array + // Used in _fnGetRowElements + if ( typeof mDataSrc !=3D=3D 'number' ) { + oSettings._rowReadObject =3D true; + } +=09 + /* Feature sorting overrides column specific when off */ + if ( !oSettings.oFeatures.bSort ) + { + oCol.bSortable =3D false; + th.addClass( oClasses.sSortableNone ); // Have to add class here as ord= er event isn't called + } +=09 + /* Check that the class assignment is correct for sorting */ + var bAsc =3D $.inArray('asc', oCol.asSorting) !=3D=3D -1; + var bDesc =3D $.inArray('desc', oCol.asSorting) !=3D=3D -1; + if ( !oCol.bSortable || (!bAsc && !bDesc) ) + { + oCol.sSortingClass =3D oClasses.sSortableNone; + oCol.sSortingClassJUI =3D ""; + } + else if ( bAsc && !bDesc ) + { + oCol.sSortingClass =3D oClasses.sSortableAsc; + oCol.sSortingClassJUI =3D oClasses.sSortJUIAscAllowed; + } + else if ( !bAsc && bDesc ) + { + oCol.sSortingClass =3D oClasses.sSortableDesc; + oCol.sSortingClassJUI =3D oClasses.sSortJUIDescAllowed; + } + else + { + oCol.sSortingClass =3D oClasses.sSortable; + oCol.sSortingClassJUI =3D oClasses.sSortJUI; + } + } +=09 +=09 + /** + * Adjust the table column widths for new data. Note: you would probably = want to + * do a redraw after calling this function! + * @param {object} settings dataTables settings object + * @memberof DataTable#oApi + */ + function _fnAdjustColumnSizing ( settings ) + { + /* Not interested in doing column width calculation if auto-width is dis= abled */ + if ( settings.oFeatures.bAutoWidth !=3D=3D false ) + { + var columns =3D settings.aoColumns; +=09 + _fnCalculateColumnWidths( settings ); + for ( var i=3D0 , iLen=3Dcolumns.length ; i