[web2py] Re: LOAD form deferred by jQuery UI tabs -- how to?

2012-12-02 Thread Joe Barnhart
Thanks guys.  I got it working with web2py_component.  What an amazing 
resource!  This ajax stuff is actually getting approachable to javascript 
novices like me.

The final user interface has tabs that select different forms, and on one 
of the tabs an accordion that exposes multiple forms.  It's all 
demand-loaded and works perfectly with the submit button and response.flash 
stuff.  And I'm only missing a modest amount of hair from pulling out it 
out doing javascript debugging!

-- Joe

On Saturday, December 1, 2012 7:24:15 AM UTC-8, Anthony wrote:

 The LOAD helper simply generates HTML like the following:

 script type=text/javascript!--
 web2py_component(/test/comment/post.load,c282718984176)
 //--/scriptdiv id=c282718984176loading.../div


 So, a div with a particular id is created, and the web2py_component() 
 Javascript function (defined in /static/js/web2py.js) is called with the id 
 of that div. Instead of using the LOAD helper, you can manually create a 
 div and set up an event handler that calls web2py_component() when the tab 
 is clicked.

 Anthony


 On Saturday, December 1, 2012 4:45:49 AM UTC-5, Joe Barnhart wrote:

 So I'm designing the world's greatest user interface and I happened on 
 the idea of making my numerous SQLFORMs easier to navigate by using jQuery 
 UI tabs and the load ajax feature.

 Conceptually, what I want to do should be simple.  Load the form using 
 =LOAD, but only when the tab is clicked on.  When the user clicks on 
 another tab, another SQLFORM is ajax-loaded, and so forth.

 Both jQuery UI and the web2py LOAD features work perfectly alone.  I can 
 even use the LOAD function with jQuery tabs as long as I don't try to use 
 the beforeLoad event to load the form.  I just can't figure out the 
 javascript secret sauce to get them to play together.

 I'm really impressed by the power of the web2py LOAD function.  The 
 contributor really knew what he was doing!  If I can just understand its 
 underpinnings a little better I can use it for more than the simple case in 
 the book.



-- 





[web2py] Re: LOAD form deferred by jQuery UI tabs -- how to?

2012-12-01 Thread Niphlod
load calls web2py_component(), that is defined in web2py_ajax.js . Look at 
that if you're looking to an integration with your code.

On Saturday, December 1, 2012 10:45:49 AM UTC+1, Joe Barnhart wrote:

 So I'm designing the world's greatest user interface and I happened on the 
 idea of making my numerous SQLFORMs easier to navigate by using jQuery UI 
 tabs and the load ajax feature.

 Conceptually, what I want to do should be simple.  Load the form using 
 =LOAD, but only when the tab is clicked on.  When the user clicks on 
 another tab, another SQLFORM is ajax-loaded, and so forth.

 Both jQuery UI and the web2py LOAD features work perfectly alone.  I can 
 even use the LOAD function with jQuery tabs as long as I don't try to use 
 the beforeLoad event to load the form.  I just can't figure out the 
 javascript secret sauce to get them to play together.

 I'm really impressed by the power of the web2py LOAD function.  The 
 contributor really knew what he was doing!  If I can just understand its 
 underpinnings a little better I can use it for more than the simple case in 
 the book.



-- 





[web2py] Re: LOAD form deferred by jQuery UI tabs -- how to?

2012-12-01 Thread Anthony
The LOAD helper simply generates HTML like the following:

script type=text/javascript!--
web2py_component(/test/comment/post.load,c282718984176)
//--/scriptdiv id=c282718984176loading.../div


So, a div with a particular id is created, and the web2py_component() 
Javascript function (defined in /static/js/web2py.js) is called with the id 
of that div. Instead of using the LOAD helper, you can manually create a 
div and set up an event handler that calls web2py_component() when the tab 
is clicked.

Anthony


On Saturday, December 1, 2012 4:45:49 AM UTC-5, Joe Barnhart wrote:

 So I'm designing the world's greatest user interface and I happened on the 
 idea of making my numerous SQLFORMs easier to navigate by using jQuery UI 
 tabs and the load ajax feature.

 Conceptually, what I want to do should be simple.  Load the form using 
 =LOAD, but only when the tab is clicked on.  When the user clicks on 
 another tab, another SQLFORM is ajax-loaded, and so forth.

 Both jQuery UI and the web2py LOAD features work perfectly alone.  I can 
 even use the LOAD function with jQuery tabs as long as I don't try to use 
 the beforeLoad event to load the form.  I just can't figure out the 
 javascript secret sauce to get them to play together.

 I'm really impressed by the power of the web2py LOAD function.  The 
 contributor really knew what he was doing!  If I can just understand its 
 underpinnings a little better I can use it for more than the simple case in 
 the book.



--