Jump to content

Refresh Dashboard 1.6


flobrflo

Recommended Posts

Hi, i make a dashboard module for my website.

I try to use dashboardZoneTwo with dashboardData, but i i would like use DashboardData only when i click on the refresh button.

 

I see that when page loading, there is immediatly a refresh on my module, i would like to know if i can stop this.

 

I would like something like :

- when i load page for the first time : dashmodule say "Hello Wordl"

- when i refresh : "Hello World Reload!"

 

But for the moment i got "Hello World Reload!" all time..

 

Thx for helping =)

Link to comment
Share on other sites

Maybe something like this?

 

<?php
session_start
();
if (!empty($_SESSION['dashboardcount']))
{
//Code to run on Page Refresh
}
else {

$_SESSION['dashboardcount']=1;

//Code to run on first time showing of Page

}
?>

 

 

This should show the "Code to run on first time showing of Page" only once for this browse session (i.e until the user closes the browser). Any second, third, fourth etc time the user refreshes (or goes to this page again) during this session it will get the "refresh" code/message

 

N.B. If you want to show the initial message again one time when the user leaves this page and comes back again to this page, you should unset it somewhere when leaving the page(like when pressing a submit button or cancel button or so): (maybe only problem when 'going back' with browser's back button instead of by pressing a button on the screen)

 

    unset($_SESSION['dashboardcount']);

 
 

 

My 2 cents,

pascal

Link to comment
Share on other sites

Thanks for your answer. =)

Sorry i don't explain rly good my problem ^^

I need something where i can refresh the page and i got the first message, and only when i "refresh the module" with js i got the update ^^

like this: "refreshDashboard('dashproducts');"

 

It seem like when the content is loading, the dashboard automaticaly call "refreshDashboard('dashmodule');" for all block.

And i'm surprise there is no way to stop this...

(i don't found it ^^)

 

any way, thx again for your answer but i need your help a little more =d

Link to comment
Share on other sites

Hi Flo,

 

Sorry for late response, was in Bangkok for a few days...

 

Not sure if I understand what you need/what happens now. Can you show the code of the page you want to have refreshed through the javascript? Do you say that the javascript is automatically run when loading the page for the first time? Please some some code where you define and call the javascript...

 

pascal.

Link to comment
Share on other sites

No problem. ^^

 

So, i will try to explain exactly. =)

 

For the moment, when i go to my dashboard page, all my dash module (DashZoneTwo) call their ajax method : "refreshDashboard('dashproducts');", "refreshDashboard('dashgoals');", ...

 

You know, it's the right-top button of the panel per module, for reload data.

 

I don't find the call. but the button is:

<a class="list-toolbar-btn" title="refresh" onclick="refreshDashboard('dashgoals');" href="javascript:void(0);">
<i class="process-icon-refresh"></i>
</a>

(my module works totaly like that but i prefer explain with a nativ module)

 

The function Js refreshDashboard call the hook :

public function hookDashboardData($params){
...
}

So i try to don't call this hook when i go on the dashboard page and don't engage action to reload data of my module.

(like i need to keep old data when i come on page and actualise them when i click on the refresh button)

Link to comment
Share on other sites

  • 2 weeks later...

Hi Flo,

 

Sorry for late response again. Busy live lately 8-[

Did you find a solution already?

 

If not:

If I understand you well, you have an onClick function that should only run when clicked (as the name suggests...) but it runs automatically when loading the page, right?

 

If so see this link:

http://stackoverflow.com/questions/14425397/onclick-function-runs-automatically

 

Maybe that helps?

 

If not: Does the function also run (i.e. is the refresh executed) when clicking on the button, or does it only run once when loading the page and that's it (i.e. the button doesn't do anything)?

 

pascal.

Link to comment
Share on other sites

Hi.

I actually don't resolv my question but i still work on the same module. ^^

 

The onclick run on the 2 ways, when i load the page and when i click on the button.

I think it's made for load the page faster with all dashmodule (that's why all dashboard module run the ajax at start ?)

 

So, in js folder is see on admin-dashboard.js

$(document).ready( function () {
...
refreshDashboard(false, false);
...
}

I suppose it's for refresh all dashboard, and i'm trying to stop my refresh-module here.

Link to comment
Share on other sites

Okay i find a way (after 2weeks...)

And the answer is so easy...

 

All dashmodule get the class "widget" and this is only use to refresh module at start.

So i delete this class of my module and that's all...

 

Too much time for nothing..

 

Any way, thank you for your time =)

That really help me <3

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...