Quantcast
Channel: Piwik Forums - Support & Bugs
Viewing all articles
Browse latest Browse all 4243

refresh widget doesn't work (no replies)

$
0
0
Hi,

I'm trying to refresh my own randomNumber widget when clicking on an area, but doesn't work.
I tried as it's indicated in the FAQ but it didn't work.

Quote
piwik's FAQ
Reload a widget in the dashboard
It is sometimes useful to reload one widget in the dashboard (for example, every 20 seconds for a real time widget, or after a setting change). You can easily force your widget to reload in the dashboard by calling the helper function $(this).parents('[widgetId]').dashboardWidget('reload');

This is my example code in the Controller.php file...

class Piwik_EXAMPLE_Controller extends Piwik_Controller
{
    function randomNumber()
    {
        echo "	<SCRIPT LANGUAGE='javascript'>
					function refreshRandom()
					{
						$(this).parents('[widgetId]').dashboardWidget('reload');
//						$(this).parents('[widgetEXAMPLEconcurrentUsers]').dashboardWidget('reload');

						alert('click');
					}
				</SCRIPT>

    			<p onclick=\"refreshRandom()\">Click this text to refresh!!!.</p>";


        echo "<p><center><H1>".rand(0 ,5000)." randomNumber</H1></center></p>";
    }
}


Thanks and regards.

Viewing all articles
Browse latest Browse all 4243

Trending Articles