Skip to content

Instantly share code, notes, and snippets.

@gergoerdosi
Created May 23, 2011 16:59
Show Gist options
  • Save gergoerdosi/987048 to your computer and use it in GitHub Desktop.
Save gergoerdosi/987048 to your computer and use it in GitHub Desktop.
Patch to allow setting the offset manually
Index: table.php
--- table.php Base (BASE)
+++ table.php Locally Modified (Based On LOCAL)
@@ -83,10 +83,16 @@
*/
public function set( $property, $value = null )
{
+ if(is_object($property)) {
+ $property = (array) KConfig::toData($property);
+ }
+
parent::set($property, $value);
// If limit has been changed, adjust offset accordingly
- if($limit = $this->_state->limit) {
\ No newline at end of file
+ if((is_array($property) && isset($property['limit']) && !isset($property['offset']) || $property == 'limit')
+ && $limit = $this->_state->limit)
+ {
\ No newline at end of file
$this->_state->offset = $limit != 0 ? (floor($this->_state->offset / $limit) * $limit) : 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment