On Sep 27, 2:31 pm, delsur <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am needing a grid whose contents refresh when we have a change in
> database. I am thinking in to use some refresh function every 5
> seconds , for example, to refresh cell contents . But I couldn't find
> any example in how to replace mouse or button event with a timer
> event.
> Could you help me ?
>
> Thanks !
Hey,
I have some similar code that updates a page with the output of a long
running command. I had luck with plain JavaScript timeouts and the
mochikit ajax functions. I passed the url to query to the kid
template in advance
runcommand.kid:
<body>
<div id="command_output" style="border: 1px solid; overflow:auto;
height:450px; width:800px">
Command output will update soon...
</div>
<script>setInterval('async_command_output("${url}",5000);</script>
</div>
</body>
The async_command_output is simply an AJAX call back to an ajax
controller I have defined:
ajax.py:
class AjaxController:
@expose(allow_json=True)
def runcommand(self):
#do stuff
return dict(stuff=stuff)
runcommand.js:
function async_command_output(url){
d = doSimpleXMLHttpRequest(url+"/ajax/runcommand");
d.addCallback(display_command_output);
}
function display_command_output(xmlhttp)
{
var o = evalJSONRequest(xmlhttp);
document.getElementById("command_output").innerHTML = '<pre>'+o.data
+'</pre>';
}
I think you could use a similar approach, I'm just not sure how to get
the async_command_output call into the DataGrid widget. I hope I
understood the question properly.
Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---