Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » List View page break after additional rows
Re: List View page break after additional rows [message #2298 is a reply to message #2297] Mon, 07 September 2009 18:52 Go to previous messageGo to previous message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
The only way I can do this is to replace the _cm_ListView_pre_print() method with two alternative methods - _cm_ListView_print_before() and _cm_ListView_print_after(). See the attached file.

Here are some examples of both methods in use:
    function _cm_ListView_print_before ($prev_row, $curr_row)
    // allow extra rows to be created in List View
    {
        $output = array();

        if (!empty($prev_row)) {
            // row has changed
            if (substr($prev_row['last_name'], 0, 1) != substr($curr_row['last_name'], 0, 1)) {
            	$this->pdf->AddPage();
            } // if
        } // if

        $output[0]['pers_type_desc'] = 'before ' .$curr_row['person_id'];

        return $output;

    } // _cm_ListView_print_before

    // ****************************************************************************
    function _cm_ListView_print_after ($curr_row)
    // allow extra rows to be created in List View
    {
        $output = array();

       	$output[0]['pers_type_desc'] = 'after ' .$curr_row['person_id'];

        return $output;

    } // _cm_ListView_print_after

As you can see this allows _cm_ListView_print_before() to call $this->pdf->AddPage() when the first character of the surname/last_name field changes.

NOTE: if your table class contains the old _cm_ListView_pre_print() method then this will be called in preference to the two new methods, so any code which uses the old method will still work and the new methods will not be called.

Try it out and tell me if it does what you want.


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: curr_or_hist='C' and output2
Next Topic: Maximum Query Execution Time
Goto Forum:
  


Current Time: Mon Nov 25 01:32:45 EST 2024

Total time taken to generate the page: 0.01114 seconds