Hi all, I am having problems displaying data in DataTables when using DateRangePicker for filtering. I have same example but with regular Table and it works. Examples are below
This DataTables does not work for selected dates. It does show data for default date I entered in configuration.
DataTables::create(array(
'name' => 'DataTable1',
// 'dataSource' => function() {
// return $this->src('automaker')
// ->query("select SifraMat, BarCode, SifArtOdDob, NazivMat, sum(kolicina) as Kolicina, sum(Iznos) as Iznos from cm_prodaja where Dobavljac = :korisnik and DatumOtprem between :start and :end group by SifraMat, BarCode, SifArtOdDob, NazivMat order by SifraMat")
// ->params(array(
// ":korisnik"=>$this->params["korisnik"],
// ":start"=>$this->params["dateRange"][0],
// ":end"=>$this->params["dateRange"][1],
// ));
// // ->query("select concat(e.first_name, ' ', e.last_name) as emp_name,
// // s.* from salaries s left join employees e on s.emp_no = e.emp_no");
// },
"dataStore"=>$this->dataStore("sumirana_prodaja"),
//'scope' => $this->params,
"options" => array(
"searching" => true,
"paging" => true,
"colReorder" => true,
"select"=>true,
"order" => [],
"ordering" => true,
"pageLength" => 50,
),
"columns"=>array(
"SifraMat"=>array(
"label"=>"Šifra artikla",
"type"=>"text"
),
"BarCode"=>array(
"label"=>"Barkod",
"type"=>"text"
),
"SifArtOdDob"=>array(
"label"=>"Šifra u dobavljača",
"type"=>"text"
),
"NazivMat"=>array(
"label"=>"Naziv artikla",
"type"=>"text"
),
"Kolicina"=>array(
"label"=>"Količina",
"type"=>"number",
),
"Iznos"=>array(
"label"=>"Iznos",
"type"=>"number",
"suffix"=>".00 KM",
"cssStyle"=>"text-align:right; font-weight: bold !important"
)
),
"showFooter"=>true,
"serverSide"=>true,
"themeBase"=>"bs4",
"method"=>"post", //default method = 'get'
));
Here is regular basic Table which works perfectly for selected dynamic dates from date picker.
Table::create(array(
//"dataStore"=>$data,
"title"=>"Sumirana prodaja za dobavljača",
"dataStore"=>$this->dataStore("sumirana_prodaja"),
"columns"=>array(
"SifraMat"=>array(
"label"=>"Šifra artikla",
"type"=>"text"
),
"BarCode"=>array(
"label"=>"Barkod",
"type"=>"text"
),
"SifArtOdDob"=>array(
"label"=>"Šifra u dobavljača",
"type"=>"text"
),
"NazivMat"=>array(
"label"=>"Naziv artikla",
"type"=>"text"
),
"Kolicina"=>array(
"label"=>"Količina",
"type"=>"number",
),
"Iznos"=>array(
"label"=>"Iznos",
"type"=>"number",
"suffix"=>".00 KM",
"cssStyle"=>"text-align:right; font-weight: bold"
)
),
"cssClass"=>array(
"th"=>"cssHeader",
"tr"=>"cssItem"
),
"paging"=>array(
"pageSize"=>50,
"pageIndex"=>0,
),
));
Can someone have a look and let me know does DataTables:: works with this DataRangePicker. Thanks in advance