Capture Empty Datasource in Viewer
Capture Empty Datasource in Viewer
How can I capture event in which I can check if datasource is empty?
On Report.onBeginRender is not possible. isEmpty from dictionario.datasources.getByIndex(0) return true, but it has rows. There is any event on I can check this values?
Thansk. This is my html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>{{$title}} - {{config('app.name')}}</title>
<?php
$js->renderHtml();
?>
<script type="text/javascript">
<?php
$handler->renderHtml();
?>
function onBeforeRender(event)
{
console.debug(event.report); <--- here event.report.dictionario.datasources.getByIndex(0).isEmpty return true
}
function onLoad() {
<?php
$viewer->renderHtml('viewerContent');
?>
}
</script>
</head>
<body onload="onLoad();">
<div id="viewerContent"></div>
</body>
</html>
On Report.onBeginRender is not possible. isEmpty from dictionario.datasources.getByIndex(0) return true, but it has rows. There is any event on I can check this values?
Thansk. This is my html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>{{$title}} - {{config('app.name')}}</title>
<?php
$js->renderHtml();
?>
<script type="text/javascript">
<?php
$handler->renderHtml();
?>
function onBeforeRender(event)
{
console.debug(event.report); <--- here event.report.dictionario.datasources.getByIndex(0).isEmpty return true
}
function onLoad() {
<?php
$viewer->renderHtml('viewerContent');
?>
}
</script>
</head>
<body onload="onLoad();">
<div id="viewerContent"></div>
</body>
</html>
-
- Posts: 7033
- Joined: Tue Mar 20, 2018 5:34 am
Re: Capture Empty Datasource in Viewer
Hello,
What data sources are you use in your report - is it file XML, JSON or SQL sources?
Thank you.
What data sources are you use in your report - is it file XML, JSON or SQL sources?
Thank you.
Re: Capture Empty Datasource in Viewer
Hi.
SQL Source. MySQL indeed
SQL Source. MySQL indeed
-
- Posts: 7033
- Joined: Tue Mar 20, 2018 5:34 am
Re: Capture Empty Datasource in Viewer
Hello,
Please try to check the onEndProcessData event:
https://www.stimulsoft.com/en/documenta ... l_data.htm
Thank you.
Please try to check the onEndProcessData event:
https://www.stimulsoft.com/en/documenta ... l_data.htm
Thank you.
Re: Capture Empty Datasource in Viewer
Hi, thanks for reply
But, where? in HTML / Javascript I can't capture onEndProcessData. How can i do it? I try to update my php StiReport object with $this->onEndProcessData = true, at the same way with onBeginRender event, the event onEndProcessData never fires.
In addition, the viewer, after render, fires an alert with this message: "Unknown event [EndProcessData]"
My HTML:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>{{$title}} - {{config('app.name')}}</title>
<?php
$js->renderHtml();
?>
<script type="text/javascript">
<?php
$handler->renderHtml();
?>
function onBeforeRender(event)
{
var variable = event.report.dictionary.variables.getByName('CULTURE')
if (variable) variable.value = "{{$report->culture}}";
}
function onEndProcessData(event)
{
console.debug(event.report); <--------------------- this never fires
}
function onLoad() {
<?php
$viewer->renderHtml('viewerContent');
?>
}
</script>
</head>
<body onload="onLoad();">
<div id="viewerContent"></div>
</body>
</html>
But, where? in HTML / Javascript I can't capture onEndProcessData. How can i do it? I try to update my php StiReport object with $this->onEndProcessData = true, at the same way with onBeginRender event, the event onEndProcessData never fires.
In addition, the viewer, after render, fires an alert with this message: "Unknown event [EndProcessData]"
My HTML:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>{{$title}} - {{config('app.name')}}</title>
<?php
$js->renderHtml();
?>
<script type="text/javascript">
<?php
$handler->renderHtml();
?>
function onBeforeRender(event)
{
var variable = event.report.dictionary.variables.getByName('CULTURE')
if (variable) variable.value = "{{$report->culture}}";
}
function onEndProcessData(event)
{
console.debug(event.report); <--------------------- this never fires
}
function onLoad() {
<?php
$viewer->renderHtml('viewerContent');
?>
}
</script>
</head>
<body onload="onLoad();">
<div id="viewerContent"></div>
</body>
</html>
-
- Posts: 7033
- Joined: Tue Mar 20, 2018 5:34 am
Re: Capture Empty Datasource in Viewer
Hello,
Please check the following samples:
https://github.com/stimulsoft/Samples-Reports.PHP
Thank you.
Please check the following samples:
https://github.com/stimulsoft/Samples-Reports.PHP
Thank you.
Re: Capture Empty Datasource in Viewer
Hi. Thanks for reply.
In my case, my version of library was 2023.4. I've updated to 2025.1 and now, with server side rendering and new report/viewer classes all is more easy.
I'm going to close this thread, and open another with a server-side rendering and exporting.
Bye.
In my case, my version of library was 2023.4. I've updated to 2025.1 and now, with server side rendering and new report/viewer classes all is more easy.
I'm going to close this thread, and open another with a server-side rendering and exporting.
Bye.
-
- Posts: 7033
- Joined: Tue Mar 20, 2018 5:34 am
Re: Capture Empty Datasource in Viewer
Hello,
You are welcome.
You are welcome.