Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8996667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:47:06+00:00 2026-06-15T23:47:06+00:00

I’ve got a Rails app utilizing pjax (pjax.heroku.com/) so that my header and navbar

  • 0

I’ve got a Rails app utilizing pjax (pjax.heroku.com/) so that my header and navbar don’t ever reload. It’s all fine and dandy and working, BUT in one of my views I’m using a data table (datatables.net). The data table works great when you first load up the page, but if you navigate away to another page and then come back, the table doesn’t “reinitiate”, so it doesn’t work and everything looks like crap. Apparently it’s because the data tables js file isn’t getting loaded up again due to pjax.

Here’s what I’ve got:

application.js:

//= require jquery
//= require jquery_ujs
//= require pjax
//= require_tree .

In the head of application.html.erb I have:

<%= javascript_include_tag "application" %>

And then wrapped the <%= yield %> in a div with data-pjax-container.

I’m calling the data-tables js file in index.html.erb (hard-coded) underneath the table:

<script type="text/javascript" src="/data-table.js"></script>

Then in a separate custom.js file, this is what initiates the table:

$(document).pjax('a[data-pjax]');
$('.openinside').pjax('.sidebarInner');

Any idea what’s going on here? I think the table isn’t being reinitiated, but how can I make it reinitiate when the header isn’t getting loaded every time due to Pjax? I tried putting the JS link right beneath the table even and that didn’t work!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:47:07+00:00Added an answer on June 15, 2026 at 11:47 pm

    Not sure if this helps (since this question is from a month ago now), but I’m in a similar boat. I have a pjax datatable that loads in my in my pages coffeescript file.

    So I’m calling the load on pjax:end, which does work, but I’m now looking for a way to load if it’s called normally (so either document complete or on pjax:end).

    $(document).on "pjax:end", ->
      $("#leads_table").dataTable({bJQueryUI: true, sPaginationType: "full_numbers", bRetrieve: true})
    

    Maybe this helps (or helps someone else).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a small JavaScript validation script that validates inputs based on Regex. I
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.