Permalink
Browse files

fixing bug where iDisplayLength is missing

  • Loading branch information...
1 parent 7bfa4bf commit 70501e2d8feb3c79e693ef09a43fd9830bed3a2f @jasondew jasondew committed Sep 19, 2011
Showing with 5 additions and 0 deletions.
  1. +1 −0 lib/data_table/base.rb
  2. +4 −0 spec/data_table_spec.rb
@@ -36,6 +36,7 @@ def _yield_and_render_array controller, objects, block
end
def _page params
+ return 1 if params[:iDisplayLength].blank?
params[:iDisplayStart].to_i / params[:iDisplayLength].to_i + 1
end
@@ -69,6 +69,10 @@
context "#_page" do
context "with a display length of 10" do
+ it "should return 1 when display length is blank" do
+ send(:_page, {:iDisplayStart => "0"}).should == 1
+ end
+
it "should return 1 when start is blank" do
send(:_page, {:iDisplayStart => "", :iDisplayLength => "10"}).should == 1
end

0 comments on commit 70501e2

Please sign in to comment.