charts shown on a grid

Hi
I’m working with SC since a view weeks and found a lot answers in the forum and in the help!
Thanks for this! But now I’m not sure what to do!
I try to build a grid application and like to show a chart.
My current solution is to use a container. Widget 1 is the chart, widget 2 is the grid!
After change the client (record) in the grid the chart in the widget 1 should change as well (refresh!)
I found a lot of entries in the forum, but they are quite complicated.
Is der now easy way too have a function in the grid-events to say refresh widgetXYZ?

Thank in advanced
Uwe

First of all, it’s not that complicated to trigger the application running in another grid. In fact, just a refresh message would do? But you need to insert a piece of javascript into your code and call that.

 echo '<script type="text/javascript">function disp_a(xfrm,xuri) { parent.document.getElementById("id-iframe-widget1").src="../form_sideline/form_sideline.php?glob_id=newcustomer&glob_shopid=generic"; } </script>';

 $javascript_function   = 'disp_a';  // Javascript function name
 $javascript_parameters = array('','');// add parms here
 
// Call javascript function
  sc_ajax_javascript($javascript_function, $javascript_parameters);


You need to change above code if you want to use xfrm and xuri to be used, but the idea should be clear. To find out which widgetname you need to use you need to dive into the generated html. But if you have a static form (your graph) then above should work.

Hi Albert
Thanks for your replay!
I know I have to learn a lot.
I tried following;
In the grid I put under programming the first part of your Example!
I called the php-Method: refresh_chart
Contend:
echo ‘<script type=“text/javascript”>function refresh_chart(xfrm,xuri) { parent.document.getElementById(“id-iframe-widget1”).src="…/chart_cpm_risc_client/chart_cpm_risc_client.php?glob_nkunde=nkunde"; } </script>’;
Under the Event ‘onRecord’ I tried to call the function:
[glo_nkunde]= {nkunde};
$javascript_function = ‘refresh_chart’; // Javascript function name
$javascript_parameters = array(’’,’’);// add parms here
// Call javascript function
sc_ajax_javascript($javascript_function, $javascript_parameters);
Puhh now I’m earning a Fatal-Error!
Fatal error: Call to undefined function sc_ajax_javascript() in C:\Program Files (x86)\NetMake\v8\wwwroot\scriptcase\app\CPM_DEV\grid_cpm_risc_client\index.php on line 506

!