The Joomla! Forum ™



Forum rules


Forum Rules
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 46 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed Sep 01, 2010 4:31 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 19, 2009 10:25 am
Posts: 19
Hi guys,
Today, I'm very happy to found the solution to one of my old problem !! Thanks a lot.
I have updated my code, it works well except when I change the number of row to display !!
When I don't change it, I have an URL like this :
http://127.0.0.1/myproject/index.php/co ... &start=125
When I change the number of row to display, it becomes :
http://127.0.0.1/myproject/index.php/co ... ?start=100

Any idea why the URL changes ?
What should I do to solve the problem or what extra information do you need to better understand my problem ?
Thanks a lot
Thierry


Top
 Profile  
 
PostPosted: Wed Sep 15, 2010 6:51 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 08, 2008 7:33 am
Posts: 45
First, thanks to this thread, finally I got the pagination working, but....

I dont get the limit working in the FE. In the backend everything works fine. I use the same model in BE and FE, so I didnt expected any problems using it in the FE.

My problem is that my js says: "this.form is null Line 1", when I try to use selector which chooses the number of items to display.

I tried to add different js files via $document->addScript(JURI::base().'includes/js/joomla.javascript.js');

But I dont get it. Help would be very nice.

Thanks


Top
 Profile  
 
PostPosted: Wed Sep 15, 2010 7:46 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Feb 01, 2009 9:10 pm
Posts: 18
Milbo wrote:
First, thanks to this thread, finally I got the pagination working, but....

I dont get the limit working in the FE. In the backend everything works fine. I use the same model in BE and FE, so I didnt expected any problems using it in the FE.

My problem is that my js says: "this.form is null Line 1", when I try to use selector which chooses the number of items to display.

Thanks


If you used the code I posted, then your form may have a different name and that's why its not working, can you post all the code you are using in reference to this issue?


Top
 Profile  
 
PostPosted: Wed Sep 15, 2010 11:05 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 08, 2008 7:33 am
Posts: 45
I just used billengle tipp to get the switching of the pages to work:
Code:
//$limitstart = $mainframe->getUserStateFromRequest(JRequest::getVar('option').'.limitstart', 'limitstart', 0, 'int');
$limitstart = JRequest::getVar('limitstart', 0, '', 'int');


I use this lines both in BE and FE:
Code:
<?php echo $this->pagination->getListFooter(); ?>


I avoid to use your tip, because the component must work without changing corefiles. Or is it possible to extend the class?

Thanks for helping


Top
 Profile  
 
PostPosted: Wed Sep 15, 2010 11:56 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Feb 01, 2009 9:10 pm
Posts: 18
Milbo wrote:

I avoid to use your tip, because the component must work without changing corefiles. Or is it possible to extend the class?

Thanks for helping


I used my way because i wanted it to work. good luck


Top
 Profile  
 
PostPosted: Thu Sep 16, 2010 9:52 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 08, 2008 7:33 am
Posts: 45
you maybe did not understand me. I mean your tip changing the core files of joomla, I didnt meant your tips in general. It is usefull to get a page working, with some component/module or plugin for a special site, but is not useable for a bigger component, which is already used by thousands of people.

And as I asked. Maybe it is possible to extend this class, even when there is no abstract tag in the class definition.

On the other hand, I wonder how the other 3rd party developers solve this problem, when it is part of the joomla core files?


Top
 Profile  
 
PostPosted: Thu Sep 16, 2010 2:59 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Feb 01, 2009 9:10 pm
Posts: 18
Milbo wrote:
On the other hand, I wonder how the other 3rd party developers solve this problem, when it is part of the joomla core files?


they write their own


Top
 Profile  
 
PostPosted: Thu Sep 16, 2010 4:46 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 08, 2008 7:33 am
Posts: 45
poor solution by joomla then. There were several security patches since you posted your fix. Hmm annoying.


Top
 Profile  
 
PostPosted: Thu Oct 14, 2010 5:33 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Jun 16, 2010 4:23 pm
Posts: 7
This is a great fix to a very frustrating problem. To make sure the links behave as intended I suggest adding href="#" (to ensure you get a mouse pointer and for css), return false to the onclick call (to ensure the page doesn't jump to the top when the link is clicked) and class=\"pagenav\" (to make sure css is applied).

This line:

naturalcrusader wrote:
Code:
return "\n<a title=\"".$item->text."\"  onclick=\"javascript: document.adminForm.limitstart.value=".$item->base."; document.adminForm.submit(); \" >".$item->text."</a>";


Becomes this:

Code:
return "\n<a title=\"".$item->text."\" href=\"#\" onclick=\"javascript: document.adminForm.limitstart.value=".$item->base."; document.adminForm.submit();return false; \" class=\"pagenav\">".$item->text."</a>";


Top
 Profile  
 
PostPosted: Thu Oct 14, 2010 11:41 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 08, 2008 7:33 am
Posts: 45
Interesting, here is my solution that worked finally

So now it looks like that in the model:
Code:
$this->setState('limit', $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $config->getValue('config.list_limit'), 'int'));
$this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int'));

// In case limit has been changed, adjust limitstart accordingly
$this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));


I use this lines in FE view.html.php:
Code:
$pagination = $model->getPagination();
$this->assignRef('pagination',   $pagination);

and in the layout:
Code:
<form name="adminForm" method="post">
<?php echo $this->pagination->getListFooter(); ?>
</form>


No changing of core files are needed, pagination works fine now.


Top
 Profile  
 
PostPosted: Thu Oct 14, 2010 1:33 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Feb 01, 2009 9:10 pm
Posts: 18
Milbo wrote:
Interesting, here is my solution that worked finally

So now it looks like that in the model:
Code:
$this->setState('limit', $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $config->getValue('config.list_limit'), 'int'));
$this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int'));

// In case limit has been changed, adjust limitstart accordingly
$this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));


I use this lines in FE view.html.php:
Code:
$pagination = $model->getPagination();
$this->assignRef('pagination',   $pagination);

and in the layout:
Code:
<form name="adminForm" method="post">
<?php echo $this->pagination->getListFooter(); ?>
</form>


No changing of core files are needed, pagination works fine now.


nice, great work!


Top
 Profile  
 
PostPosted: Thu Oct 14, 2010 2:03 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 19, 2009 10:25 am
Posts: 19
I've just updated my model. It works fine except when i change the number of row to display in the listbox. It works randomly...sometimes, the new page has only a few lines, without the buttons to go to next pages (Even if there are other rows to display...) when I go back with the Firefox button, then it is correctly displayed ...)
Sometime, nothing is displayed...
It seems something is missing to be perfect !
Nobody has an idea about that ?
Thanks
Thierry


Top
 Profile  
 
PostPosted: Thu Oct 14, 2010 3:08 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 08, 2008 7:33 am
Posts: 45
Strange, for me it works, even with changing numbers, maybe you missed the second line (// In case limit has been changed, adjust limitstart accordingly ).

Of course it is a bit strange to set it twice. I am not quite sure if it is optimized, but at least it works for me. :-)


Top
 Profile  
 
PostPosted: Thu Oct 14, 2010 7:33 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Oct 19, 2009 10:25 am
Posts: 19
I have the 2nd line...and it doesn't work...Sometimes I have error message like this :
Quote:
Trying to get property of non-object in C:\Program Files (x86)\EasyPHP5.3.0\www\totosicocm\components\com_content\views\frontpage\view.html.php on line 123


In my model I have :
Code:
   function __construct()
   {
      parent::__construct();
      global $mainframe, $option;

                $this->setState('limit', $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int'));
                $this->setState('limitstart', JRequest::getVar('limitstart', 0, '', 'int'));

                // In case limit has been changed, adjust limitstart accordingly
                $this->setState('limitstart', ($this->getState('limit') != 0 ? (floor($this->getState('limitstart') / $this->getState('limit')) * $this->getState('limit')) : 0));
        }

   /**
    * Method to get item data
         */
   function getData()
   {
      if (empty($this->_data))
      {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
      }

      return $this->_data;
   }

   /**
    * Method to get the total number of items
    *
    */
   function getTotal()
   {
      if (empty($this->_total))
      {
         $query = $this->_buildQuery();
         $this->_total = $this->_getListCount($query);
      }

      return $this->_total;
   }

   /**
    * Method to get a pagination object
    */
   function getPagination()
   {
      if (empty($this->_pagination))
      {
         jimport('joomla.html.pagination');
         $this->_pagination = new JPagination( $this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
                }

      return $this->_pagination;
   }




In my Default :
Code:
        <tfoot class="paginate">
            <tr>
                <td  colspan="8" >
                    <?php echo $this->pagination->getListFooter(); ?>
                </td>
            </tr>
        </tfoot>

In view.html :
Code:
      $items   =& $this->get('data');
      $total      = & $this->get( 'Total');
      $pagination = & $this->get( 'Pagination' );


If someone can help me, I will be very pleased...
thanks
Thierry


Top
 Profile  
 
PostPosted: Wed Dec 14, 2011 4:07 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Dec 14, 2011 3:59 pm
Posts: 39
I have this problem with the component JomSocial User List. What it does is categorizing JomSocial users by some criteria like profile type and profile fields, etc.
So, when one clicks on the userlist - a list of users appears according to some criteria... fine and very cool. When one goes to 2nd, 3rd page, etc. and one wants to go back to the start of category, clicking "beginning" or "1st page" does not work. It returns to 2nd page with start=5
example url when you click beginning or 1st page:
joomlafolder/userlistname?start=5

Anyone care to help to make it work with start=0 or remove the whole start variable idea for the 1st page? I am out of ideas.


Top
 Profile  
 
PostPosted: Mon Apr 09, 2012 3:41 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Apr 08, 2012 10:28 am
Posts: 5
Hi there, this may be help you http://www.mangluoiweb.com/2012/03/comb ... r-and.html.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 46 posts ]  Go to page Previous  1, 2



Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group