Jump to content


[WORKAROUND] Problem with $crud->limit doesn't work properly

limit per_page

  • Please log in to reply
5 replies to this topic

#1 bilal99

bilal99

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 10 June 2012 - 05:48 AM

Hi,

This is my first post .. First of all i'd say that there is no alternate of Grocery CRUD .. i really appreciate you guys efforts.it saves alot of time.Well, i am having an issue regarding limit of records ... i am using version 1.1.3 of grocery crud the code for limiting records is below

$crud->limit(5);

Everything work perfect but it does not get limited records.

Thanks in Advance.

#2 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,099 posts
  • LocationLondon

Posted 10 June 2012 - 03:45 PM

Hello there and welcome to the forum.

Yes you are right it doesn't work. I added as a bug ( https://github.com/s...-crud/issues/62 ) . Thank you to mention it.
Posted Image

#3 bilal99

bilal99

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 12 June 2012 - 04:34 AM

Do you want me to work on it and fix this bug or is it already been fixed ???

#4 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,099 posts
  • LocationLondon

Posted 12 June 2012 - 06:49 AM

If you want you can give a try but it is not so easy fix. I will give it a try in the future as it is a more complicated issue. Of course the contributions are always welcome :D
Posted Image

#5 bilal99

bilal99

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 12 June 2012 - 06:42 PM

Hi, i have fixed the problem ... actually the problem was here in grocery_crud.php (library) and line number 868 to 878, look at comments i just commented the if condition for pagination cause atm, there is no config defined for library:

//if($this->config['crud_paging'] === true)
//{
   if($this->limit == null)
   {
	$this->basic_model->limit(25);
   }
   else
   {
	$this->basic_model->limit($this->limit[0],$this->limit[1]);
   }
  //}

By the way, thanks Web-Johny :)

#6 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,099 posts
  • LocationLondon

Posted 12 June 2012 - 10:59 PM

Ok for now the users can use this code as a workaroun. I want to tested by my own and then added to the master release. Don't worry as long as it is tracked at git-hub it will be fixed at the future (or close this issue because it can cause other problems but still :) )

And also thanks to share your fix.
Posted Image





Also tagged with one or more of these keywords: limit, per_page

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users