Add Pagination to JModelAdmin - Joomla! Forum - community, help and support
hello,
i'm in big trouble ;-)
i got 2 views: "mails" , "mail". view "mails" shows conversations, view "mail" shows messages linked conversation.
if save changes made in "mail"-view, these changes stored in multiple tables: #__bestia_mails , #__bestia_mails_messages.
well, read out details conversation , linked mails, i'm using jmodeladmin, because supports checkout, permissions , on.
to linked messages wrote custom getitem()-method this:
now wanted add pagination, pagination supported getlistquery. not see way how use getlistquery here, because need jmodeladmin use checkout-method etc.
so used tutorial: http://www.tutsforu.com/pagination-in-j ... onent.html
well, way works, pagination shown , shows correct number of buttons (2 buttons if have 6-10 messages), if click on 1 of buttons, i'm getting redirected standard-view of component.
any idea how can change this?
thanks in advance :-)
i'm in big trouble ;-)
i got 2 views: "mails" , "mail". view "mails" shows conversations, view "mail" shows messages linked conversation.
if save changes made in "mail"-view, these changes stored in multiple tables: #__bestia_mails , #__bestia_mails_messages.
well, read out details conversation , linked mails, i'm using jmodeladmin, because supports checkout, permissions , on.
to linked messages wrote custom getitem()-method this:
code: select all
public function getitem($pk = null)
{
if ($item = parent::getitem($pk))
{
// convert metadata field array.
$registry = new jregistry;
if(isset($item->metadata))
{
$registry->loadstring($item->metadata);
$item->metadata = $registry->toarray();
}
if (!empty($item->id))
{
$item->tags = new jhelpertags;
$item->tags->gettagids($item->id, 'com_bestia.mail');
$item->metadata['tags'] = $item->tags;
}
if(!empty($item->mailid))
{
// messages
$db = $this->getdbo();
$query = $db->getquery(true);
$query->select('*');
$query->from('#__bestia_mails_messages');
$query->where('mailid = '. $db->quote( $item->mailid));
// order messages
$query->order('date desc');
$db->setquery($query);
if ($db->geterrornum())
{
echo $db->geterrormsg();
exit;
}
$item->messages = $db->loadobjectlist();
}
}
now wanted add pagination, pagination supported getlistquery. not see way how use getlistquery here, because need jmodeladmin use checkout-method etc.
so used tutorial: http://www.tutsforu.com/pagination-in-j ... onent.html
well, way works, pagination shown , shows correct number of buttons (2 buttons if have 6-10 messages), if click on 1 of buttons, i'm getting redirected standard-view of component.
any idea how can change this?
thanks in advance :-)
Comments
Post a Comment