KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

DateTimePicker SubReport Clears Out From Field #1183

Open Jason opened this topic on on Nov 26 - 4 comments

Jason commented on Nov 26

I have a form with a subreport, I set the default From/To Date range, and also bind the min/max dates to each other. Then on change of a dropdown that calls an subreport update, i lose the To Date value, but not the From Date.

<div class="form-group"> 
	<div class="row">
		<div class="col-md-6">
			<strong>From Date:</strong>
			<?php
			DateTimePicker::create(array(
				"name"=>"startDatePicker",
				"maxDate"=>"@endDatePicker",
				"format"=>"MM/DD/YYYY h:mm A",
				"themeBase"=>"bs4",
			));
			?>
		</div>
		<div class="col-md-6">
			<strong>To Date:</strong>
			<?php
			DateTimePicker::create(array(
				"name"=>"endDatePicker",
				"minDate"=>"@startDatePicker",
				"format"=>"MM/DD/YYYY h:mm A",
				"themeBase"=>"bs4",
			));
			?>
		</div>
	</div>
</div>
<div class="col-md-6 form-group">
<strong>Trending Group</strong>
<?php
Select::create(array(
	"name"=>"trendTypeSelected",
	"dataStore"=>$this->dataStore("trendTypes"),
	"dataBind"=>"device",
	"attributes"=>array(
		"class"=>"form-control",
	),
	"clientEvents"=>array(
		"change"=>"function(){
			console.log('Testing change 1');
			subReport.update('trendselecting',{
/* 										startDatePicker:$('input[name=\"startDatePicker\"]').val(),
				endDatePicker:$('input[name=\"endDatePicker\"]').val(), */
				trendTypeSelected:$('#trendTypeSelected').val(),
			});
		}",
	)
));
?>
</div>

KoolReport commented on Nov 29

Have you set up binding between "startDatePicker" widget and the parameter of report?

Jason commented on Dec 2

Yes I have. In binddefaultparameter and settingDefaultValues.

//Set Default Param Values
protected function defaultParamValues(){
	
	//Set Current EST DateTime Minus 1 Hour For Default Trending Range
	$startDate = date('m/d/Y h:i A' , strtotime( '-1 hour' ));

	//Current EST DateTime Minus 1 Hour For Default Trending Range
	$endDate = date('m/d/Y h:i A');
	error_log("START DATE " . $startDate);
	error_log("END DATE " . $endDate); 
    return array(
        "startDatePicker"=>$startDate,
        "endDatePicker"=>$endDate,
        "trendTypeSelected"=>"AC",
        "trendsToView"=>array("---","---"),
    );
}

This is bound in the Primary preport (TrendSelecting) and the DatePicker is actually part of the sub report(TrendViewing)

KoolReport commented on Dec 2

I mean binding parameter to inputs with bindParamsToInputs() method. If possible, please send you code to support@koolreport.com, I would like to see if I can spot something.

Jason commented on Dec 2

//Map Inputs to Form Parameters

protected function bindParamsToInputs()
{
    return array(
        "trendTypeSelected",
        "trendsToView",
        "startDatePicker",
        "endDatePicker",
    );
}

Sorry, yes i did bind them there as well.

KoolReport Is Free and Open-Source!

KoolReport is a professional php reporting framework which saves you tons of time to construct dynamic data report & dashboard.

  • Connect to various datasources such as MySQL, SQL Server, MongoDB or even from CSV or Excel file.
  • Contain series of powerful built-in data processes for your data manipulation.
  • Generate stunning charts and graphs to help you communicate data insights to your audiences effectively.
  • Integrate seamlessly with any php frameworks such as Laravel, CodeIgniter, Symfony.
Download Now and register our tutorials to get started!

Download KoolReport
help needed

Inputs