| Page 1 of 1 | [ 9 posts ] |
|
This code works for me if I want to load data immediately:
Code: myDataTable = new YAHOO.widget.DataTable( "myDiv", colDefs, myDataSource, { initialLoad: true} ); I have a need to delay the data load though, but this is not working for me: Code: myDataTable = new YAHOO.widget.DataTable( "myDiv", colDefs, myDataSource, { initialLoad: false} ); //TODO: doing some stuff here myDataTable.load(); I also tried this with no luck: Code: myDataTable = new YAHOO.widget.DataTable( "myDiv", colDefs, null, { initialLoad: false} ); //TODO: doing some stuff here myDataTable.load({'datasource': myDataSource}); Any ideas what I am doing wrong? Thanks. Ken |
|
Your second code block should work with myDataTable.load() but it your case you are sending in a "null" request object which only works with local data (i.e. LocalDataSource). If you are using remote data this won't work.
I worked up a jsfiddle that shows delayed loading of local data works at http://jsfiddle.net/blunderalong/gvFBm/. If you are using remote data, the load command expects a configuration object that includes {request:'your request string here...', callback: callback_obj}. This is probably why your last code snippet didn't work, you had a malformed argument. Most of us use myDataSource.sendRequest( ... parameters ...) to load or reload remote data in a DT. ... I still recommend you read the API and other references I mentioned in your other posting, this stuff is well-documented! I'll let others chime in if you don't like what I am telling you! .... |
|
Todd I do appreciate the help you have given me so far, but...
I have read through plenty of YUI documentation over time for various reasons. That's how I know that things like "initialLoad: false" and "myDataTable.load()" exist. I come here to ask questions about things I must have missed or don't understand. |
|
BTW I am using a YAHOO.util.LocalDataSource. This still does not work, event though I am not passing null as the datasource:
Code: myDataTable = new YAHOO.widget.DataTable( "worksheetBodyDiv", colDefs, myLocalDataSource, { initialLoad: false } ); myDataTable.load(); |
|
Delayed loading for local data should work as the jsfiddle I did does, did the example work for you?
You could further define the load configuration ( the request, callback members ...) and see if you can isolate what breaks. If your case isn't working I would suspect a problem with either the colDefs (formatters, editors, etc...) or your myLocalDataSource (parsers, etc..). A browser debugger such as Firebug in Firefox, or Dev Tools in Chrome become essential at this point to set breakpoints, watch variables, etc... Also, you may consider removing functionality to get to a point that works ... i.e. take column formatters off, take editors off, etc... |
|
I dont have editors or formatters defined, so that could not have been an issue, so I followed your advice and used FireBug to see where the issue is:
respondToReadyState() is throwing an Exception with message "TypeError: calibrationRequest.dataTable.load is not a function". There must be a simple stupid mistake somewhere |
|
Now this is very strange. When I set a breakpoint and inspect my datatable just before the call to load(), I can see everything is present but there is no load() method defined. How can that be?
I am using DataTable version 2.6.0. Maybe it is too old. |
|
This thread is probably getting a little long. If you want to provide a pastie link or jsfiddle or gist to your full code somebody can look it over for you. (it's not good to clog up this forum with large code blocks!).
Also you can go on the IRC chat freenode.net the #yui channel and ask questions there live. BTW, YUI 2.6.0 is pretty ancient ! |
|
Everything works after upgrading to 2.9.0. The datatable load method did not exist in 2.6.0.
|
| Page 1 of 1 | [ 9 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group