ruby on rails - Will ajax will pagination is rendergin the page twice -


i using ajax pagination in rails application. pagination working perfectly. in 1 page when click on next page link. showing page twice. in other pages working fine.

here index.js.erb:

$('.sort_paginate_ajax').html("<%= escape_javascript(render("jobs"))%>");     $(".tablesorter").tablesorter(); 

and index.html.erb like:

<div class="sort_paginate_ajax"><%= render 'jobs' %></div> 

the server log is:

started "/jobs?page=2&_=1400322005679" 127.0.0.1 @ 2014-05-17 15:50:12 +0530 processing jobscontroller#index js   parameters: {"page"=>"2", "_"=>"1400322005679"}   user load (0.5ms)  select "users".* "users" "users"."id" = 2 order "users"."id" asc limit 1   job load (0.5ms)  select "jobs".* "jobs" limit 2 offset 2    (0.3ms)  select count(*) "jobs"   location load (0.4ms)  select "locations".* "locations" "locations"."id" = 2   client load (0.4ms)  select "clients".* "clients" "clients"."id" = 2   location load (0.5ms)  select "locations".* "locations" "locations"."id" = 1   client load (0.4ms)  select "clients".* "clients" "clients"."id" = 1 deprecation warning: link_to_function deprecated , removed rails 4.1. recommend using unobtrusive javascript instead. see http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript. (called link @ /var/www/selectcom/app/helpers/will_paginate_helper.rb:16) deprecation warning: link_to_function deprecated , removed rails 4.1. recommend using unobtrusive javascript instead. see http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript. (called link @ /var/www/selectcom/app/helpers/will_paginate_helper.rb:16) deprecation warning: link_to_function deprecated , removed rails 4.1. recommend using unobtrusive javascript instead. see http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript. (called link @ /var/www/selectcom/app/helpers/will_paginate_helper.rb:16) deprecation warning: link_to_function deprecated , removed rails 4.1. recommend using unobtrusive javascript instead. see http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript. (called link @ /var/www/selectcom/app/helpers/will_paginate_helper.rb:16)   rendered jobs/_jobs.html.erb (15.3ms)   rendered jobs/index.js.erb (18.7ms) completed 200 ok in 28ms (views: 22.5ms | activerecord: 3.0ms) 

here _jobs file:

<tbody>      <% @jobs.each |job| %>        <tr>          <td><%= job.created_at %></td>          <% @locations = location.where(:id => job.location_id) %>            <% if(@locations.length != 0) %>              <% @locations.each |location| %>                 <td><%= location.site %></td>                 <td><%= location.city.capitalize %>/<%= location.state.capitalize %></td>              <% end %>            <% end %>          <% @clientlist = client.where(:id => job.client_id) %>              <% if(@clientlist.length != 0) %>               <% @clientlist.each |client| %>                 <td><%= client.clientname.capitalize %></td>               <% end %>             <% end %>          <td>todo</td>          <td>todo</td>          <td><%= job.salesorder %></td>          <td>todo</td>           <td><%= link_to '', edit_job_path(job),:class =>'edit_icon' %><%= link_to 'x', job, :class=>'rmv-fld', method: :delete, data: { confirm: 'are sure?' } %></td>        </tr>      <% end %>    </tbody>  </table>  <% if @jobs.length!=0 %>      <div class="me-tdy">            <table width="100%" border="0" style="border:none !important" class="table_clr2 table">              <tbody> <tr>             <td width="90%" align="left" style="border:none"><h2 style="padding:0;" class="job_heading">jobs</h2></td>              <td width="10%" style="border:none">               <div class="arrow_bx">               <%= ajax_will_paginate @jobs, :params => { :my_excluded_param => nil } %>               </div></td>            </tr>        </tbody></table>          </div>  </div><% else  %> 


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -