<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Can't get jqgrid on rails to display data</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>steffen780 on Can't get jqgrid on rails to display data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4675</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4675</guid>
        	        	<description><![CDATA[<blockquote>
<p>steffen780 said:</p>
</p>
<p>app/views/planets:</p>
<p>&#60;%= jquery_grid :sample, {:url =&#62; grid_data_planet_url } %&#62; doesn&#39;t</p>
</blockquote>
<hr />
<p>The file name is of course: app/views/planets/index.html.erb</p>
<p>And the first line should read: &#60;%= jquery_grid :sample, {:url =&#62; grid_data_planets_url } %&#62;</p>
]]></description>
        	        	<pubDate>Tue, 17 Feb 2009 05:53:56 +0200</pubDate>
        </item>
        <item>
        	<title>steffen780 on Can't get jqgrid on rails to display data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4674</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4674</guid>
        	        	<description><![CDATA[<p>That&#39;s what I worked off actually 🙂 Should&#39;ve probably mentioned that..</p>
<p>Basically I just copied that code, replacing bits where relevant with my own object name (ie planets instead of people). Other than that the differences are me trying to get it to work <img class="spSmiley" style="margin:0" title="Innocent" src="/blog/wp-content/plugins/simple-forum/tinymce/plugins/emotions/img/smiley-innocent.gif" border="0" alt="Innocent" /></p>
<p>Is there any particular bit that I should be looking at? I compared everything probably a dozen times by now but I just seem to be unable to find it 🙁</p>
]]></description>
        	        	<pubDate>Tue, 17 Feb 2009 05:51:36 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Can't get jqgrid on rails to display data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4671</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4671</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Could you please look here:</p>
<p><a href="http://www.rubyrailways.com/add-a-powerful-ajax-table-to-your-rails-application-in-5-minutes/" rel="nofollow" target="_blank"><a href="http://www.rubyrailways.com/ad" rel="nofollow">http://www.rubyrailways.com/ad</a>.....5-minutes/</a></p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 17 Feb 2009 05:35:31 +0200</pubDate>
        </item>
        <item>
        	<title>steffen780 on Can't get jqgrid on rails to display data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4670</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4670</guid>
        	        	<description><![CDATA[<p>I found a mistake I made in sample.yml, :sortname is now set to player_name but still the same result 🙁</p>
]]></description>
        	        	<pubDate>Tue, 17 Feb 2009 05:08:48 +0200</pubDate>
        </item>
        <item>
        	<title>steffen780 on Can't get jqgrid on rails to display data</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4651</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/cant-get-jqgrid-on-rails-to-display-data#p4651</guid>
        	        	<description><![CDATA[<p>Hi all,</p>
<p>I&#39;m trying to use jqgrid in ruby on rails to display a table, but I can&#39;t get it to display the data. If i go to <a href="http://127.0.0.1:3000/planets" rel="nofollow" target="_blank">http://127.0.0.1:3000/planets</a> it only shows me the table heading.</p>
<p>If I go to <a href="http://127.0.0.1:3000/planets/grid_data" rel="nofollow" target="_blank">http://127.0.0.1:3000/planets/grid_data</a> however it does show the correct information (tho it complains "This XML file does not appear to have any style information associated with it. The document tree is shown below." but I think that is normal).</p>
<p>I&#39;ve tried various things but I just can&#39;t get it to work 🙁</p>
<p>Here&#39;s what I think are the relevant bits of my source files. I cut out bits where I&#39;m pretty sure that they don&#39;t matter but put [...] to denote where I made cuts.</p>
<p>app/views/planets:</p>
<p>&#60;%= jquery_grid :sample, {:url =&#62; grid_data_planet_url } %&#62; doesn&#39;t<br />#using this doesnt work either: &#60;%= jquery_grid :sample, {:url =&#62; "http://127.0.0.1:3000/planets/grid_data" } %&#62;</p>
<p>&#60;center&#62;<br />&#160;&#160; &#60;div style="background :black; color:white; width:818px;"&#62;Planets - Uni40.org&#60;/div&#62;<br />&#160;&#160; &#60;%= jquery_grid_table %&#62;<br />&#160;&#160; &#60;%= jquery_grid_pager %&#62;<br />&#160;&#60;/center&#62;<br />&#160;<br />&#60;br /&#62;</p>
<p>app/controllers/planets_controller.rb:</p>
<p>[...]<br />&#160; def grid_data<br />&#160;&#160;&#160;&#160;&#160; params[:sidx]=:id<br />&#160;&#160;&#160;&#160;&#160; params[:sord]="asc"<br />&#160;&#160;&#160;&#160;&#160; params[:rows]=20<br />&#160;&#160;&#160; @planets = Planet.all(:order =&#62; "#{params[:sidx]} #{params[:sord]}")<br />&#160; &#160;<br />&#160;&#160;&#160; respond_to do &#124;format&#124;<br />&#160;&#160;&#160;&#160;&#160; format.xml { render :partial =&#62; &#39;grid_data.xml.builder&#39;, :layout =&#62; false }<br />&#160;&#160;&#160; end&#160; &#160;<br />&#160; end<br />[...]</p>
<p>config/routes.rb:</p>
<p>ActionController::Routing::Routes.draw do &#124;map&#124;<br />&#160; map.resources :planets, :collection =&#62; {:grid_data =&#62; :get}<br />&#160; map.resources :planets<br />[...]</p>
<p>app/views/layouts/application.html.erb:</p>
<p>&#60;html&#62;<br />&#160;&#160;&#160; &#60;head&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;title&#62;Railpot in Ajax&#60;/title&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;meta http-equiv="content-type" content="text/html; charset=utf-8" /&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;%= javascript_include_tag &#39;jquery&#39; %&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;%= include_jquery_grid_javascript %&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;%= include_jquery_grid_css %&#62;<br />&#160;&#160;&#160; &#60;/head&#62;<br />&#160;&#160;&#160; &#60;body&#62;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;%= yield %&#62;<br />&#160;&#160;&#160; &#60;/body&#62;<br />&#60;/html&#62; <br />&#60;/pre&#62;</p>
<p>app/views/planets/_grid_data.xml.builder:</p>
<p>xml.instruct! :xml, :version=&#62;"1.0", :encoding=&#62;"UTF-8"<br />xml.rows do<br />&#160; xml.page params[:page]<br />&#160; xml.total_pages(@planets.size.to_i / params[:rows].to_i)<br />&#160; xml.records{@planets.size}<br />&#160; @planets.each do &#124;u&#124;<br />&#160;&#160;&#160; xml.row :id =&#62; u.id do<br />&#160;&#160;&#160;&#160;&#160; xml.cell u.universe_id<br />&#160;&#160;&#160;&#160;&#160; xml.cell u.player_name<br />&#160;&#160;&#160;&#160;&#160; xml.cell u.galaxy_no<br />&#160;&#160;&#160;&#160;&#160; xml.cell u.system_no<br />&#160;&#160;&#160;&#160;&#160; xml.cell u.planet_no<br />&#160;&#160;&#160; end<br />&#160; end<br />end</p>
<p>config/jquery_grid/sample.yml:</p>
<p>---<br />:before: var lastsel2;<br />:params:<br />&#160; :datatype: xml<br />&#160; :mtype: GET<br />&#160; :colNames:<br />&#160; - universe_id<br />&#160; - player_name<br />&#160; - galaxy_no<br />&#160; - system_no<br />&#160; - planet_no<br />&#160; :colModel:<br />&#160; - :width: 130<br />&#160;&#160;&#160; :index: universe_id<br />&#160;&#160;&#160; :name: universe_id<br />&#160;&#160;&#160; :editable: true<br />&#160; - :width: 130<br />&#160;&#160;&#160; :index: player_name<br />&#160;&#160;&#160; :name: player_name<br />&#160;&#160;&#160; :editable: true<br />&#160; - :width: 80<br />&#160;&#160;&#160; :index: galaxy_no<br />&#160;&#160;&#160; :name: galaxy_no<br />&#160;&#160;&#160; :editable: false<br />&#160; - :width: 80<br />&#160;&#160;&#160; :index: system_no<br />&#160;&#160;&#160; :name: system_no<br />&#160;&#160;&#160; :editable: false<br />&#160; - :width: 80<br />&#160;&#160;&#160; :index: planet_no<br />&#160;&#160;&#160; :name: planet_no<br />&#160;&#160;&#160; :editable: false<br />&#160; :pager: $(&#39;#&#60;grid_name&#62;_pager&#39;)<br />&#160; :function_onSelectRow: "(id)<br />&#160;&#160;&#160;&#160;&#160;&#160; if(id &#38;&#38; id!==lastsel2) {<br />&#160;&#160;&#160;&#160;&#160; $(&#39;#&#60;grid_name&#62;&#39;).restoreRow(lastsel2);<br />&#160;&#160;&#160;&#160;&#160; $(&#39;#&#60;grid_name&#62;&#39;).editRow(id,true);<br />&#160;&#160;&#160;&#160;&#160; lastsel2=id;<br />&#160;&#160;&#160; }"<br />&#160; :sortname: first_name<br />&#160; :sortorder: desc&#160; &#160;<br />&#160; :rowNum: 10<br />&#160; :imgpath: /stylesheets/jqGrid-themes/basic/images</p>
<p>What am I missing?</p>
<p>Cheers, Steffen</p>
]]></description>
        	        	<pubDate>Mon, 16 Feb 2009 17:03:01 +0200</pubDate>
        </item>
</channel>
</rss>