Forums

Pagination does not return to current page after editing a r

giori 03 Feb, 2011
Hello,

just received the Chronoforms Cookbook, very nice and good-looking, practical book, definitely better than scrolling through the 360 pages of the ebook version. I have worked through the tutorials and created a small intranet solution to archive songsheets for a church. It consist of two forms, one to collect songsheets information, the other to collect a list of composers that will be used as a dropdown field in the songsheets form.

Although quite time consuming to set-up the whole thing. The typo error “domReady” instead of “domready” in one of the tutorials took quite an amount of time being solved, the other was my fault as I wrote “filter_order_dir” instead of “filter_order_Dir”. Obviously it made the difference to make sortable columns working.

The one problem not solved yet is returning to the current page when editing a record. Pagination always returns to page 1. If I select a record on page 10 for editing, edit and save the record I would like to return to the current page 10 and not to page 1. How can this be done? I have basic php and mysql skills, can handle code snippets quite well, but not necessarily skilled in developing new code.

Some other questions:
Is it correct that I do not need to validate chronoforms/chronoconnectivity on localhost? Validation seems to work only on real web sites.

At first I made the two tables relational. That worked well in chronoforms, but in chronoconnectivity it seems impossible to create a listing with data from two different tables. Is that correct? In the songsheets listing I wanted to have only the composer_id and retrieve the composer_name from the composer-table. Didn’t find a solution for that.

Many thanks for a very good product.
Kind regards
Giori
GreyHead 03 Feb, 2011
Hi Giori,

Please take a look at this thread for a partial solution to the pagination problem - though it does seem to be template dependent :-(

There are a few workarounds for the 'complex query' problem:[list]
  • You can build MySQL Views and link the Listing to a View
  • You can add a query inside the Body box, not recommended for a very busy site but Ok for a small one
  • There's a hacked version of CC in the forums here that will take complex queries (not tested by Max or I but reported to work)
  • [/list]

    Validation is a question of taste. For a private site you can mostly ignore it; for a busy public site that is possibly a hacking target it's essential . . . and there are all stages in between.

    Bob

    PS Do you remember where the domReady error was? If so, I'll fix it.
    giori 03 Feb, 2011
    Hi Bob,
    thank you for the quick reply.

    Please take a look at this thread for a partial solution to the pagination problem - though it does seem to be template dependent



    Yes, I saw this thread, but I was not sure, whether it addressed the same problem. Obviously I have to dig deeper as I am using a Joomla template I created myself and did quite some customization of the pagination on the css level. I will do some testing with a standard Joomla template.

    I saw the various workarounds about chronoconnectivity and multiple tables, but did not find the hacked version.

    The typo error is in your tutorial "Dynamic filters for your listing part 1 on page 5 and 11, it is correct in other tutorials. That was probably the reason I thought capitalization doesn't matter. Well it doesn't really matter in the Windows world, it does matter in the Unix/Linux world.

    Greetings
    Giori
    GreyHead 03 Feb, 2011
    Hi Giori,

    If you copy and paste the pagination html here I'll take a look. The applied CSS shouldn't make a difference.

    I've had a look for the hacked version and I can't find it either :-( I'll keep my eyes open.

    I've updated the document to fix my mistake with domready, thank you.

    Bob
    giori 03 Feb, 2011

    Hi Giori,
    If you copy and paste the pagination html here I'll take a look. The applied CSS shouldn't make a difference.Bob



    Here is the code from templates/tpl-name/html/pagination.php (Comments stripped)
    Don't remember where I got it from.

    
    /**
     * @version		$Id: pagination.php 10381 2008-06-01 03:35:53Z pasamio $
     */
    function pagination_list_footer($list)
    {
    	// Initialize variables
    	$lang =& JFactory::getLanguage();
    	$html = "<div class=\"list-footer\">\n";
    	$html .= "\n<div class=\"limit\">".JText::_('Display Num').$list['limitfield']."</div>";
    	$html .= $list['pageslinks'];
    	$html .= "\n<div class=\"counter\">".$list['pagescounter']."</div>";
    	$html .= "\n<input type=\"hidden\" name=\"limitstart\" value=\"".$list['limitstart']."\" />";
    	$html .= "\n</div>";
    	return $html;
    }
    
    function pagination_list_render($list)
    {
    	// Initialize variables
    	$lang =& JFactory::getLanguage();
    	$html = "<div class=\"pagination\">";
    	$html .= $list['start']['data'];
    	$html .= $list['previous']['data'];
    	foreach( $list['pages'] as $page )
    	{
    		if($page['data']['active']) {
    			// $html .= '<strong>';
    		}
    		$html .= $page['data'];
    		if($page['data']['active']) {
    			//  $html .= '</strong>';
    		}
    	}
    
    	$html .= $list['next']['data'];
    	$html .= $list['end']['data'];
    	// $html .= '«';
    	$html .= "</div>";
    	return $html;
    }
    function pagination_item_active(&$item) {
    	return "<span class=\"active-page\"><a href=\"".$item->link."\" title=\"".$item->text."\">".$item->text."</a></span>";
    }
    function pagination_item_inactive(&$item) {
    	return "<span class=\"inactive-page\">".$item->text."</span>";
    }
    ?>


    Thanks for helping!
    Greetings
    Giori
    GreyHead 03 Feb, 2011
    Hi Giori.

    Please can you copy the final HTML from View Source so that I can see what classes have been applied. it will be something like this
    <div class="list-footer">
      <div class="limit">Display #
        <select onchange="this.form.submit()" size="1" class="inputbox" id="limit" name="limit">
          <option value="5">5</option>
          <option value="10">10</option>
          <option value="15">15</option>
          <option value="20">20</option>
          <option selected="selected" value="25">25</option>
          <option value="30">30</option>
          <option value="50">50</option>
          <option value="100">100</option>
          <option value="0">All</option>
        </select>
      </div>
    << <span class="pagenav">Start</span> < <span class="pagenav">Prev</span> <span class="pagenav">1</span> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=25" title="2">2</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=50" title="3">3</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=75" title="4">4</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=100" title="5">5</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=125" title="6">6</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=150" title="7">7</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=175" title="8">8</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=200" title="9">9</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=25" title="Next">Next</a> 
    > <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=200" title="End">End</a> 
    >>
    <div class="counter">Page 1 of 9</div>
    <input type="hidden" value="0" name="limitstart">
    </div>

    Bob
    GreyHead 15 Feb, 2011
    Hi Giori,

    Many thanks for the info and apologies again for the delay. The critical part is that we need to pull a list of the non-active links from this code:
    <div class="list-footer">
    . . .
    << <span class="pagenav">Start</span>
     < <span class="pagenav">Prev</span> 
     <span class="pagenav">1</span> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=25" title="2">2</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=50" title="3">3</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=75" title="4">4</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=100" title="5">5</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=125" title="6">6</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=150" title="7">7</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=175" title="8">8</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=200" title="9">9</a> 
    <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=25" title="Next">Next</a> 
    > <a class="pagenav" href="/component/chronoconnectivity/?connectionname=Obituaries&start=200" title="End">End</a> 
    >>
    <div class="counter">Page 1 of 9</div>


    I think that this should uniquely identify them:
    var pagelinks = $$('div.list-footer a.pagenav');
    please will you give it a test.

    Bob
    CMG27 15 Aug, 2013
    I dont undestand where i need to write the code

    var pagelinks = $$('div.list-footer a.pagenav');
    GreyHead 17 Aug, 2013
    Hi CMG27,

    You need to look at the original post that this goes back to. It was about the fourth line down.

    Bob
    This topic is locked and no more replies can be posted.