I''m trying to incorporate Rico''s LiveGrid functionality into a Rails page. So far I''ve been able to download rico.js into my public/javascripts folder and load it into the <head> section of my application.rhtml using javascript_include_tag. Following Rico''s tutorial at http://openrico.org/docs/RicoLiveGrid.pdf, I added the option onload="javascript:bodyOnLoad()" to my <body> in application.rhtml. Moving to the next step in the tutorial, I gave my existing Borrowers table an id="data_grid_content" and created a header row table with id="data_grid_header". Now to the problem step, the JavaScript function to actually create the grid. The tutorial uses JSP to load its table, and I want to use Rails - the instance variable @borrowers holds the proper page of data in the pre-Rico pagination setup. The code in the tutorial is: <script> var opts = { prefetchBuffer: true, onscroll: updateHeader } new Rico.LiveGrid (''data_grid_content'', 4, 1000, ''getMovieTableContent.do'', opts); </script> I tried substituting @borrowers for getMovieTableContent.do (both with and without the single quote marks). The result in either case is no response - the existing page (with the added header row) shows up as before. No grid appears. There is no error or flash message. Can anyone help with this? I know it''s just a matter of what/how to substitute and maybe also some layout issue with needing extra <div> or <table> sections. Since prototype.js is already part of Rails and rico.js uses Prototype, I thought it should be easy to incorporate Rico widgets into a Rails app. But I haven''t found any Rails LiveGrid examples out there. Shauna -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Just a stab here (I''m not positive), but it would seem to me that you would need to supply a Rails action name in place of ''getMovieTableContent.do'' that would output some sort of data structure. I don''t know what that would be, but I''m sure the tutorial/javascript file can tell you. --Jeremy On 12/18/06, Shauna <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I''m trying to incorporate Rico''s LiveGrid functionality into a Rails > page. > > So far I''ve been able to download rico.js into my public/javascripts > folder and load it into the <head> section of my application.rhtml using > javascript_include_tag. Following Rico''s tutorial at > http://openrico.org/docs/RicoLiveGrid.pdf, I added the option > onload="javascript:bodyOnLoad()" to my <body> in application.rhtml. > > Moving to the next step in the tutorial, I gave my existing Borrowers > table an id="data_grid_content" and created a header row table with > id="data_grid_header". > > Now to the problem step, the JavaScript function to actually create the > grid. The tutorial uses JSP to load its table, and I want to use Rails - > the instance variable @borrowers holds the proper page of data in the > pre-Rico pagination setup. The code in the tutorial is: > > <script> > var opts = { prefetchBuffer: true, onscroll: updateHeader } > new Rico.LiveGrid (''data_grid_content'', 4, 1000, > ''getMovieTableContent.do'', opts); > </script> > > I tried substituting @borrowers for getMovieTableContent.do (both with > and without the single quote marks). The result in either case is no > response - the existing page (with the added header row) shows up as > before. No grid appears. There is no error or flash message. > > Can anyone help with this? I know it''s just a matter of what/how to > substitute and maybe also some layout issue with needing extra <div> or > <table> sections. Since prototype.js is already part of Rails and > rico.js uses Prototype, I thought it should be easy to incorporate Rico > widgets into a Rails app. But I haven''t found any Rails LiveGrid > examples out there. > > Shauna > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry for not catching the PDF link before; it looks like you need to create a Rails action that outputs an HTML table. Rico then appears to take the HTML table and turn it into the grid. The tutorial shows how you need to format the output if you''re using AJAX. --Jeremy On 12/18/06, Shauna <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I''m trying to incorporate Rico''s LiveGrid functionality into a Rails > page. > > So far I''ve been able to download rico.js into my public/javascripts > folder and load it into the <head> section of my application.rhtml using > javascript_include_tag. Following Rico''s tutorial at > http://openrico.org/docs/RicoLiveGrid.pdf, I added the option > onload="javascript:bodyOnLoad()" to my <body> in application.rhtml. > > Moving to the next step in the tutorial, I gave my existing Borrowers > table an id="data_grid_content" and created a header row table with > id="data_grid_header". > > Now to the problem step, the JavaScript function to actually create the > grid. The tutorial uses JSP to load its table, and I want to use Rails - > the instance variable @borrowers holds the proper page of data in the > pre-Rico pagination setup. The code in the tutorial is: > > <script> > var opts = { prefetchBuffer: true, onscroll: updateHeader } > new Rico.LiveGrid (''data_grid_content'', 4, 1000, > ''getMovieTableContent.do'', opts); > </script> > > I tried substituting @borrowers for getMovieTableContent.do (both with > and without the single quote marks). The result in either case is no > response - the existing page (with the added header row) shows up as > before. No grid appears. There is no error or flash message. > > Can anyone help with this? I know it''s just a matter of what/how to > substitute and maybe also some layout issue with needing extra <div> or > <table> sections. Since prototype.js is already part of Rails and > rico.js uses Prototype, I thought it should be easy to incorporate Rico > widgets into a Rails app. But I haven''t found any Rails LiveGrid > examples out there. > > Shauna > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for responding, Jeremy. Yes, I have an existing borrowers/list.rhtml page that displays a page of Borrowers data, which I previously created based on the depot app in AWDwR. To generate that page, the borrowers_controller.rb has a method def list @borrower_pages, @borrowers = paginate :borrowers, :per_page => 8, :order_by => ''LastName, FirstName'' end This appears to collect a page of data into the @borrowers variable. So do I need to refactor or rename this def somehow? How would I refer to a controller method in the example instead of in-line js code? Shauna -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
If I''m reading it correctly, getMovieTableContent.do is merely pointing to a URL for a JSP. So, in theory you should be able to put ''list'' (or something like that) and get your desired output. Of course, this is all in theory. I''m not sure if they have some special wiring with JSPs or not. I would suggest creating a plain-jane HTML file and plugging in a simple table in there to test that theory (i.e., create ''table.html'' and replace getMovieTableContent.do with ''table.html''). I''m downloading Rico right now...if that doesn''t solve it I''ll play around with it and see if I can give you a solution. :) --Jeremy On 12/18/06, Shauna <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Thanks for responding, Jeremy. > > Yes, I have an existing borrowers/list.rhtml page that displays a page > of Borrowers data, which I previously created based on the depot app in > AWDwR. To generate that page, the borrowers_controller.rb has a method > def list > @borrower_pages, @borrowers = paginate :borrowers, :per_page => 8, > :order_by => ''LastName, FirstName'' > end > > This appears to collect a page of data into the @borrowers variable. So > do I need to refactor or rename this def somehow? How would I refer to a > controller method in the example instead of in-line js code? > > Shauna > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I tried replacing ''getMovieTableContent.do'' with ''table.html'' and replacing my Rails table-generating code with the expanded table that it turns into in the View / Page Source. It didn''t make any difference. I still get the normal rendering of the table. (I put this in a borrowers/listRico.rhtml template file and pointed the list action there. I know it got there because I changed the header row only in that template and that part rendered properly, just no liveGrid showed up.) Now I suspect I might have to do something in the .css file, or maybe I left out some other crucial piece. The sample site has more and different code than the tutorial, but the sample site includes other widgets on the same page as well. Thanks for checking out Rico! I came across a couple of other attempts to do this in the forum but no one actually said they got it. --Shauna -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hey, Jeremy - I found an example of incorporating Rico LiveGrid into a rails app. Well, it''s not exactly _incorporating_ it; it''s a standalone example, so I have to figure out how to divide up the js parts to be more generic. That is, I don''t want to reference "Borrowers" in my application.rb, which is where the <body onload= ... element is. Anyway, here''s the reference if you or anyone else want to play with it: http://richardcowin.typepad.com/blog/2006/01/new_livegrid_ma.html Shauna -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---