⚠ 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

view 20 records, instead of 10



vnt
  • profile picture
  • Member

Posted 16 April 2012 - 14:10 PM

How do I change the number of visible records in the list?

noskov.biz
  • profile picture
  • Member

Posted 16 April 2012 - 21:54 PM

Hi! Try to change lines #79 and #80 in /your_site/assets/grocery_crud/themes/flexigrid/views/list_template.php

from this

<option selected="selected" value="10">10&nbsp;&nbsp;</option>
<option value="25">25&nbsp;&nbsp;</option>


into this

<option value="10">10&nbsp;&nbsp;</option>
<option selected="selected" value="20">20&nbsp;&nbsp;</option>

vnt
  • profile picture
  • Member

Posted 19 April 2012 - 12:09 PM

I'm sorry but it does not work! The select shows 25, but the records of the list are 10.

Johnny, in the next version you can add at file grocery_croud.php, config[grocery_crud_default_list_number] ?

noskov.biz
  • profile picture
  • Member

Posted 19 April 2012 - 15:28 PM

Oh, sorry vnt. [color=#333333][font=arial, sans-serif][size=4]I've done it[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]long ago and[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]had forgotten[/size][/font][/color][color=#333333][font=arial, sans-serif][size=4]everything. And remembered only part.[/size][/font][/color]

web-johnny, [color=#333333][font=arial, sans-serif][size=4]I don't know maybe there is more simply and elegant way to do it?[/size][/font][/color]

[color=#333333][font=arial, sans-serif][size=4]But I have to change a bit the core of the grocery_crud:[/size][/font][/color]
[color=#333333][font=arial, sans-serif][size=4]1. near the line #1000 in function "get_list" I had changed lines from[/size][/font][/color]
[color=#333333][font=arial, sans-serif]

if($this->config['crud_paging'] === true)
{
if($this->limit == null)
{
$this->basic_model->limit(10);
}
else
{
$this->basic_model->limit($this->limit[0],$this->limit[1]);
}
}
[/font][/color]
[color=#333333][font=arial, sans-serif][size=4]to[/size][/font][/color]

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]);
}
}


And then in the ./assets/grocery_crud/themes/flexigrid/views/list_template.php file near line #80 I had

<select name="per_page" id='per_page'>
<option selected="selected" value="25">25&nbsp;&nbsp;</option>
<option value="50">50&nbsp;&nbsp;</option>
<option value="75">75&nbsp;&nbsp;</option>
<option value="100">100&nbsp;&nbsp;</option>
</select>


And near the lines #120-130 I had

<?php $paging_ends_to = "<span id='page-ends-to'>". ($total_results < 25 ? $total_results : 25) ."</span>"; ?>

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

Posted 20 April 2012 - 04:44 AM

Hello guys. I am sorry [member='noskov.biz'] but as you realized the default start paging is hard-coded so this is the only way for now to do it.

I like the [member='vnt'] idea and I will try to have something like:

$config['grocery_crud_default_per_page'] = 10;

[color=#282828][font=helvetica, arial, sans-serif]to a future version.[/font][/color]

noskov.biz
  • profile picture
  • Member

Posted 20 April 2012 - 06:23 AM

Yeah, I remembered how I was looking for this start paging the first time and could't find it :blink:

I also like vnt's idea. It would be simple and clear. Thanks!

vnt
  • profile picture
  • Member

Posted 20 April 2012 - 07:15 AM

Thanks so much for your help!

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

Posted 20 April 2012 - 22:55 PM

Just to inform you I added the config for version 1.2.2 (you can see the changes at https://github.com/scoumbourdis/grocery-crud/commit/04f499e22ff9e1c56bda727169f2ff2265db74ad )

It is simple you just add the line of code at your config:


// The default per page when a user firstly see a list page
$config['grocery_crud_default_per_page'] = 25; //Can only take values 10,25,50,100

noskov.biz
  • profile picture
  • Member

Posted 21 April 2012 - 07:36 AM

Oh, thanks a lot! Now it doesn't need any more to change the core and it will make easier the process of updating to new vesions of the grocery_CRUD in future. :)

vnt
  • profile picture
  • Member

Posted 22 April 2012 - 14:47 PM

Thanks a lot Johnny!

gouarv
  • profile picture
  • Member

Posted 05 May 2012 - 06:34 AM

[quote name='noskov.biz' timestamp='1334993809' post='1373']
Oh, thanks a lot! Now it doesn't need any more to change the core and it will make easier the process of updating to new vesions of the grocery_CRUD in future. :)
[/quote][quote name='web-johnny' timestamp='1334897089' post='1349']
Hello guys. I am sorry [member='noskov.biz'] but as you realized the default start paging is hard-coded so this is the only way for now to do it.

I like the [member='vnt'] idea and I will try to have something like:

$config['grocery_crud_default_per_page'] = 10;

[color=#282828][font=helvetica, arial, sans-serif]to a future version.[/font][/color]
[/quote]



How to display all record like 10,25,50,100 and all

gouarv
  • profile picture
  • Member

Posted 05 May 2012 - 06:35 AM

[quote name='noskov.biz' timestamp='1334613298' post='1270']
Hi! Try to change lines #79 and #80 in /your_site/assets/grocery_crud/themes/flexigrid/views/list_template.php

from this

<option selected="selected" value="10">10&nbsp;&nbsp;</option>
<option value="25">25&nbsp;&nbsp;</option>


into this

<option value="10">10&nbsp;&nbsp;</option>
<option selected="selected" value="20">20&nbsp;&nbsp;</option>

[/quote]

How to display all record in grid like 10,25,50,100 and add one option in list like all

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

Posted 05 May 2012 - 09:48 AM

The "all" option is not yet implemented to grocery CRUD yet, so you have to change the library to have a feature like this

xxaxxo
  • profile picture
  • Member

Posted 05 May 2012 - 17:11 PM

i'm sorry for the takeaway from the thread but I still haven't upgraded to 1.2.1.1 , and my question is - is it stable ? i've seen some quick fixes released so i'm not sure if i should upgrade ? Thank you.

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

Posted 05 May 2012 - 19:18 PM

It is stable but is better to wait for downloading 1.2.2 when it will be released (probably in 2-3 weeks). There are many bug fixes at this version and if you had the 1.2 version the upgrade will be smoothly...