PDA

View Full Version : Basic grid doesn't show in AJAX GET DIV innerHTML



stonecracker
6 Nov 2006, 3:19 AM
I have a basic grid works fine in a single html file. I even finished a AJAX context menu for that.

But when I try to get the page1(with only the body) into a DIV of the main page2, it doesn't work anymore. I replaced the load event(because the page1 doesn't load in any place, I think) to the onAvailable event of the element containing the grid.

I checked the varible "Example" as in the following snippet and I can not access it in the firebug of the main page.

Snippet:
<script>
var Example = {

init : function(){


var myData = [

['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
.....
</script>

So, how can I make the varible in the DIV innerHTML accessible in the main page. Maybe it's not the problem of the grid, but search for javascript and ajax with google simply give me nothing related. Can anybody help?

jack.slocum
6 Nov 2006, 4:32 AM
When you load the div are you loading with UpdateManager? If you are, set loadScripts = true and it will load your JS file if it's included in the loaded HTML. Once that's loaded, you will need to initialize the grid (call Example.init()) manually since the load event doesn't fire when loaded with XHR.

stonecracker
6 Nov 2006, 6:45 AM
Hi, Jack

Thanks for your prompt help. I made great improvement on the UI of my project just after reading your "A Grid Component for Yahoo! UI - Part 1", amazing... and I have alot to explore.

I didn't update the div with UpdateManager and I did it in the raw YUI way with innerHTML assignment. I just scanned the document of UpdateManager and notice that it would be the thing I was looking for, sure I'll try it soon.

stonecracker
6 Nov 2006, 8:22 AM
Jack, I tried the old release 0.32.3.1 without luck(any bug reported yet?). The 0.33Beta is working fine.

Thanks again for your great work!