<?php
namespace nur\v\bs3\vc;

use nur\b\params\Tparametrable;
use nur\v\js;

class CDatatable extends CTable {
  use Tparametrable;

  const CSS = "nur-v-bs3/datatables/datatables.css";
  const JS = "nur-v-bs3/datatables/datatables.js";

  const PARAMETRABLE_PARAMS_SCHEMA = [
    "dtclass" => ["string", "datatable", "classe des tables mises en forme par Datatable"],
    "dtconfig" => ["?array", ["order" => []], "configuration de l'objet"],
  ];

  protected $ppDtclass;

  protected $ppDtconfig;

  protected function getTableClass(): array {
    return [$this->ppTableClass, $this->ppDtclass];
  }

  const HAVE_JQUERY = true;

  function printJquery(): void {
    ?>
<script type="text/javascript">
jQuery.noConflict()(function($) {
  $(<?=js::qclass($this->ppDtclass)?>).DataTable(<?=js::qo($this->ppDtconfig)?>);
});
</script>
<?php
  }
}
