Page numbering in DataGrid

thread: 9 messages  |  last: a year ago  |  started: friday, december 9, 2005, 5:41 pm pst


#1  |  Netino (Sao Paulo, Brasil)
Friday, December 9, 2005, 5:41 PM PST

The Datagrid could have a more compact page numbering.
I have some tables with thousands of registers, and opting by pagination of 10, I have the following links to pages on the top of pages:
===================================================
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181
===================================================

This seems is related with Paginate property, but disable it is not a option for me. I have tables with much more data, so, may be filter data could be needed.

But the ideal could be have a more compact showing, like:
Page: 1 2 3 ... 181 - Go Page [ ]

where the “Go page [ ]” would be a insertable field, where page number in between would be acessible directly.

Additionally, the “Results” and “Go Page” texts, in my case, can be usable only if I would be translatable to my language.

Regards,
Netino

#2  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Saturday, December 10, 2005, 1:59 AM PST

heh heh yep -- that's actually the exact functionality i'm working on right now.

The plan is to actually create a separate “Paginator” Qform control, and the default paginator will render with something like
   1 .. 6 7 8 9 *10* 11 12 13 14 .. 22
if you are currently on page 10 of 22.

Of course, the logic that actually displays this will be in its own GetControlHtml class -- so you'll be able to easily override just that one method to have pagination display however you want it to (listbox, textbox, a bunch of number links with a textbox, left/right arrows, etc.)

*hopefully this will be up by Monday, but it will depend on scheduling.

#3  |  Netino (Sao Paulo, Brasil)
Sunday, December 11, 2005, 10:28 AM PST

Mike, You are the guy!

Regards,
Netino

#4  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Monday, December 12, 2005, 3:23 PM PST

Heheh thanks... slightly bad news -- i won't be able to get this up today.  I'm busy trying to prep for the MySQL Webcast that's on tomorrow (read the dev blog for more info)... but hopefully i'll be able to get to the changes by the end of the week.

#5  |  Alberto dos Santos (Lisbon, Portugal)
Saturday, January 7, 2006, 3:05 AM PST

Any news on this front yet?
I browsed a bit through the code but saw nothing.

Thanks.

#6  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Saturday, January 7, 2006, 4:18 AM PST

No... unfortuntaely it hasn't been checked in yet.  We're actually in middle of quite a few changes which will break BC, so we wanted to check everything at the same time to only cause this disruption once, instead of spread over multiple releases (see http://www.qcodo.com/forums/topic.php/160 for more info).

We're hoping to get this out in the next two weeks or so.

#7  |  dugokontov (Sarajevo, B&H) Bosnia & Herzegovina
Thursday, September 11, 2008, 9:02 AM PDT

Here is a way to display go to link on Paginator which will prompt user for a page number to be shown. Next code has to be added in qform>QPaginator.inc, function GetControlHtml()

$strFunctionForGoTo = sprintf("onclick =\"
  var pageOnWhichToGo = prompt('Input page number');
  if (pageOnWhichToGo == null || !isFinite(pageOnWhichToGo) || pageOnWhichToGo>%s) return false;
  qcodo.postBack('%s', '%s', 'QClickEvent', pageOnWhichToGo);
  return false;\"",
  $this->PageCount, $this->Form->FormId, $this->ControlId);
                
$strToReturn .= sprintf('&nbsp;<a href="" %s%s>%s</a>&nbsp;',
  $strFunctionForGoTo, $strPageCssClass, "Go to");
.bc
#8  |  VexedPanda (Calgary, AB) Canada
Tuesday, September 16, 2008, 3:41 PM PDT

Here's the same code syntax-highlighted, for those having trouble following it (like me :P).

<?
$strFunctionForGoTo = sprintf("onclick =\"
  var pageOnWhichToGo = prompt('Input page number');
  if (pageOnWhichToGo == null || !isFinite(pageOnWhichToGo) || pageOnWhichToGo>%s) return false;
  qcodo.postBack('%s', '%s', 'QClickEvent', pageOnWhichToGo);
  return false;\"",
  $this->PageCount, $this->Form->FormId, $this->ControlId);
                
$strToReturn .= sprintf('&nbsp;<a href="" %s%s>%s</a>&nbsp;',
  $strFunctionForGoTo, $strPageCssClass, "Go to");
?>
.bc
#9  |  VexedPanda (Calgary, AB) Canada
Tuesday, September 16, 2008, 3:44 PM PDT

This seems quite useful, and I'd like to see it preserved.
Would you mind posting that as a wiki article at <http://wiki.qcodo.com/> so that it's not lost in the forums?

(You can create an account at <http://wiki.qcodo.com/user/register>)



Copyright © 2005 - 2010, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.