Hi,
maybe others have asked, I've searched the forum and couldn't find it.
How can I show the project I designed as a shortcut directly from the home page.
Thank you.
Show Design New Project
Show Design New Project
- Attachments
-
- proje.png (37.48 KiB) Viewed 27725 times
-
- Posts: 7259
- Joined: Tue Mar 20, 2018 5:34 am
Re: Show Design New Project
Hello,
Unfortunately, it is not possible in the PHP version at the moment.
We have added this task in our to-do list.
Thank you.
#17016
Unfortunately, it is not possible in the PHP version at the moment.
We have added this task in our to-do list.
Thank you.
#17016
-
- Posts: 7259
- Joined: Tue Mar 20, 2018 5:34 am
Re: Show Design New Project
Hello,
We have added new onAfterInitialize event, in which you can use any javascript code after designer/viewer components initialization.
It will be available in the next major build 2025.3.1
Thank you.
We have added new onAfterInitialize event, in which you can use any javascript code after designer/viewer components initialization.
It will be available in the next major build 2025.3.1
Code: Select all
$designer = new StiDesigner();
$designer->onAfterInitialize = "
var newReportPanel = designer.jsObject.options.newReportPanel || designer.jsObject.InitializeNewReportPanel();
var customBigButton = designer.jsObject.NewReportPanelButton('customReportButton', 'My Report Button', 'BlankReport.png');
//If you want change button image
//customBigButton.image.src = 'https://www.google.by/images/bran/ding/googlelogo/2x/googlelogo_color_272x92dp.png';
newReportPanel.childNodes[1].addCell(customBigButton);
customBigButton.action = function () {
var fileMenu = this.jsObject.options.menus.fileMenu || this.jsObject.InitializeFileMenu();
fileMenu.changeVisibleState(false);
setTimeout(function () {
//Write your code here
alert('customReportButton was clicked!');
}, 200);
}
";
$designer->process();
Re: Show Design New Project
Thank you for the help;
I don't have much knowledge, can you help me where and how to add it?
I don't have much knowledge, can you help me where and how to add it?
Code: Select all
<?php
require_once 'vendor/autoload.php';
use Stimulsoft\Designer\StiDesigner;
use Stimulsoft\Events\StiReportEventArgs;
use Stimulsoft\Report\StiReport;
use Stimulsoft\StiResult;
// Creating a designer object and set the necessary javascript options
$designer = new StiDesigner();
//$designer->javascript->relativePath = '../';
$designer->javascript->appendHead('<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">');
$designer->options->localization = 'tr.xml';
// Defining designer events before processing
// It is allowed to assign a PHP function, or the name of a JavaScript function, or a JavaScript function as a string
// Also it is possible to add several functions of different types using the append() method
$designer->onSaveReport = function (StiReportEventArgs $args)
{
// Getting the correct file name of the report template
$reportFileName = strlen($args->fileName) > 0 ? $args->fileName : 'Report.mrt';
if (strlen($reportFileName) < 5 || substr($reportFileName, -4) !== '.mrt')
$reportFileName .= '.mrt';
// Saving the report file in the 'reports' folder on the server-side
$reportPath = "reports/$reportFileName";
$result = file_put_contents($reportPath, $args->getReportJson());
// If required, it is possible to show a message about success or some error
if ($result === false)
return StiResult::getError('An error occurred while saving the report file on the server side.');
return StiResult::getSuccess("The report has been successfully saved to '$reportPath' file.");
//return StiResult::getSuccess();
};
// Processing the request and, if successful, immediately printing the result
$designer->process();
// Creating a report object
$report = new StiReport();
// Loading a report by URL
// This method does not load the report object on the server side, it only generates the necessary JavaScript code
// The report will be loaded into a JavaScript object on the client side
$report->loadFile('reports/ee.mrt');
// Assigning a report object to the designer
$designer->report = $report;
// Displaying the visual part of the designer as a prepared HTML page
$designer->printHtml();
?>
-
- Posts: 7259
- Joined: Tue Mar 20, 2018 5:34 am
Re: Show Design New Project
Hello,
That code will work only after the release 2025.3.1.
Thank you.
That code will work only after the release 2025.3.1.
Thank you.