mellis95 Posted June 2, 2010 Share Posted June 2, 2010 I am trying to implement a OpenRico livegrid (I am not that great yet with AJAX OR Javascript, but trying to learn) I have been following a tutorial I found at : http://jerome.sadou.free.fr/grid//index.php . I am having trouble getting the grid to actually work and, according to the javascript console in Chrome, it seems to be the following function that is not working. function bodyOnLoad() { var opts = { prefetchBuffer: true, onscroll : updateHeader, sortAscendImg: 'http://localhost/accounting/classes/rico21/images/sort_asc.gif', sortDescendImg: 'http://localhost/accounting/classes/rico21/images/sort_desc.gif' }; new Rico.LiveGrid ("data_grid",10, 15, "xml_maker.php", opts); } Chrome javascript console gives the following error: "Uncaught TypeError: undefined is not a function" on this line: new Rico.LiveGrid ("data_grid",10, 15, "xml_maker.php", opts); I am sure I am missing something simple here. Thanks in advance for the help. Matt Quote Link to comment Share on other sites More sharing options...
F1Fan Posted June 2, 2010 Share Posted June 2, 2010 It appears that the Rico object isn't being set. Do you have this in your code? <script src="rico.js" type="text/javascript"></script> If you do, is it included before or after your function is called? Are you sure you are pointing to rico.js properly? Quote Link to comment Share on other sites More sharing options...
mellis95 Posted June 2, 2010 Author Share Posted June 2, 2010 It appears that the Rico object isn't being set. Do you have this in your code? <script src="rico.js" type="text/javascript"></script> If you do, is it included before or after your function is called? Are you sure you are pointing to rico.js properly? I have this: <script src="./../classes/rico21/src/rico.js" type="text/javascript"></script> immediately before the script with the bodyOnLoad function. I have triple checked the path and it should be correct. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted June 2, 2010 Share Posted June 2, 2010 Well, just to verify it, view the page source. In Firefox or Chrome the file references, such as your "./../classes/rico21/src/rico.js" will be clickable links. Click on that link and that will confirm that you are, in fact, pointing to the correct location. Quote Link to comment Share on other sites More sharing options...
mellis95 Posted June 2, 2010 Author Share Posted June 2, 2010 Well, just to verify it, view the page source. In Firefox or Chrome the file references, such as your "./../classes/rico21/src/rico.js" will be clickable links. Click on that link and that will confirm that you are, in fact, pointing to the correct location. I viewed source and clicked the link and it took me straight to rico.js, so the path is correct. Thanks, Matt Quote Link to comment Share on other sites More sharing options...
F1Fan Posted June 2, 2010 Share Posted June 2, 2010 Actually, it just occurred to me that on an AJAX call, any JS error will appear on the line where the AJAX was called. So, maybe your problem is in the xml_maker.php file. Quote Link to comment Share on other sites More sharing options...
mellis95 Posted June 2, 2010 Author Share Posted June 2, 2010 OK. I went through xml_maker.php and did find a misspelled variable name in a sql statement, but fixing that did not fix my problem. However, on looking again a little closer in the javascript console, I found this: /accounting/classes/rico21/src/rico.js:241 60: Pre-load messages: 9: include: ricoCommon.js 11: include: translations/ricoLocale_en.js 12: waitingFor: window ricoCommon.js 50: waitingFor: window 52: waitingFor: window 60: waitingFor: 60: Processing callbacks assumptions.php:43 Uncaught TypeError: undefined is not a function Now I am wondering if there is a problem in rico.js?? I didn't pay attention to this earlier because it did have ERROR written big right next to it. It is display in the "log" window in chrome js console. Is it helpful in troubleshooting this? Thanks again for the help. Matt Quote Link to comment Share on other sites More sharing options...
F1Fan Posted June 2, 2010 Share Posted June 2, 2010 I'm sorry, but I'm not sure at this point. I use Firefox to code in, and I've found the Firebug add-on to be incredibly handy. I don't know anything about the Chrome log window in the JS console, but I can tell you that Firebug will allow you to watch the AJAX calls as they happen, and view the response, as well as other things. You may want to try that. Quote Link to comment Share on other sites More sharing options...
mellis95 Posted June 2, 2010 Author Share Posted June 2, 2010 I installed Firebug, and you are right, it is extremely handy. However, it hasn't given me any errors or problems, so I am not sure where to go from here. Quote Link to comment Share on other sites More sharing options...
F1Fan Posted June 2, 2010 Share Posted June 2, 2010 You can also use Firebug to put breaks in the JS. From there you can view set variables and resume JS operation. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.