Hi
I followed a railscast episode and got datatables up and running,
beautifully along with the nice jquery-ui as in the front page.
The main issue I''m having though is that I suck at CoffeeScript/JS ~_~
I''m trying get the datatables to reload every 1 second but I don’t see
any
request coming into my webserver for refreshes and hence, no refreshes on
the web page itself.
Here''s my code:
app/assets/javascripts/comments.js.coffee
[code]
jQuery ->
$(''#comments_id'').dataTable
sPaginationType: "full_numbers"
bJQueryUI: true
bProcessing: true
setInterval(''$("#comments_id").dataTable().fnDraw()'',
1000);
[/code]
And here is the code that gets generated on the client side:
[code]
(function() {
jQuery(function() {
$(''#comments_id'').dataTable({
sPaginationType: "full_numbers",
bJQueryUI: true,
bProcessing: true
});
return
setInterval(''$("#comments_id").dataTable().fnDraw()'',
1000);
});
}).call(this);
[/code]
Help will be appreciated. ^_^
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/5XisnRjpNEkJ.
For more options, visit https://groups.google.com/groups/opt_out.
Heptagone H wrote in post #1093275:> app/assets/javascripts/comments.js.coffee > [code] > jQuery -> > $(''#comments_id'').dataTable > sPaginationType: "full_numbers" > bJQueryUI: true > bProcessing: true > setInterval(''$("#comments_id").dataTable().fnDraw()'', 1000); > [/code]Take a look at the documentation for setInterval(): http://www.w3schools.com/jsref/met_win_setinterval.asp Looking at the function signature: setInterval(code,millisec,lang) code = The function that will be executed. You have passed a string for this argument. You can''t call a string. Solution: Give setInterval a function as is expected: In JavaScript it should look something like: setInterval(function() { $("#comments_id").dataTable().fnDraw(); }, 1000); -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Reasonably Related Threads
- Jquery-Datatable-Rails Gem: Error on Update. PUT request automatically converting to a POST request.
- Problems with repeated calls to setTimeout?
- dynamically change frequency in periodicalUpdater
- [Slightly OT] Uploading files with firefox
- Really Slow Effects