⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

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



bilal99
  • profile picture
  • Member

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.

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 10 June 2012 - 15: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/scoumbourdis/grocery-crud/issues/62 ) . Thank you to mention it.

bilal99
  • profile picture
  • Member

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 ???

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

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

bilal99
  • profile picture
  • Member

Posted 12 June 2012 - 18: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 :)

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 12 June 2012 - 22: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.