Home Web Front-end HTML Tutorial FineReport layered report strategy for solving large data set display problems_html/css_WEB-ITnose

FineReport layered report strategy for solving large data set display problems_html/css_WEB-ITnose

Jun 24, 2016 am 11:40 AM

This article takes filling in a report as an example to solve the problem of displaying large data sets through paging.

The idea of ​​implementation is to filter part of the database data in SQL so that the browser can reasonably display the report page. (I use MYSQL for data segmentation and statements. If you want to use other databases, please check the FineReport help document)

Step 1: Open the fenye.cpt file.

The template interface is as follows

Two ds, part of the data, and a hidden row.

Hide a row of content as follows

The function of this data will be discussed below.

The content in ds1 is as follows

?

Statement content SELECT * from aaa limit ${f},${p}

The purpose is to start from the ${f}th jump and select ${p} data (this $p is the number of pages displayed, $f can be calculated with the following formula ($page-1)*$p, mysql limit Offsets start from 0).

In the template parameters, I set their default values ​​

$P=20

$page=1 ;

This is the same as global parameters. You cannot see the data when previewing the template. The parameters must be passed in through the URL when the page is displayed.

The content in ds2 is as follows

This statement is relatively simple, just find the total number of data and divide it by the number of pages per page to get the total Number of pages.

Report body

The data in the first row are the previous page, the next page, the total number of pages and the current page and a / , used to display the previous page and next page in the toolbar. Normally it is not displayed here, so we block (hide) it first. The rest is the display of user data.

In order to display the report the same as our normal report, what else do we need to do?

Here you need to write code to achieve the effect of the above picture.

Click on the gear to preview the application

You can see that we have used 7 custom buttons and a loading end event here

The code for the loading end event is as follows:

var toolbar = contentPane.toolbar;

var items = toolbar.options.items;

var customButton=items[2 ];//JQUERY takes the button on our toolbar. items[2] represents the third one, which is the button that is displayed as a text box.

var inner = customButton.$table;

var btnWrapper = $("em", inner);

btnWrapper.html("");

//Correct this button Properties, make it a text type, centered, and the last icon on the mouse is in editing state.

var cellValue = contentPane.curLGP.getCellValue("D1");//Getting the value of cell D1 is page, which is the current page.

var $input = $("input", btnWrapper);

$input.val(cellValue);//Copy this text control, using the JQUERY method, you can COPY .

var total=contentPane.curLGP.getCellValue("C1");

if (total>parseInt(total)){total=parseInt(total) 1;

}

contentPane.toolbar.options.items[4].setText(total);

//Display the total number of pages on the fifth control, because this value may be a decimal, So decide whether to add one or not.

contentPane.toolbar.options.items[3].setText(contentPane.curLGP.getCellValue("E1"));

//Write the slash on the 4th control.

7 custom buttons:

First homepage:

The code is as follows:

window.location.href="${servletURL}? reportlet=fenye.cpt&op=write&page=1";//Link to fenye.cpt, page parameter=1, represents the first page.

The second previous page:

The code is as follows:

var page= $("tr[tridx=0]","div.content-container") .children().eq(0).html(); //Get the content of the first cell in the first row.

if(page==0)

{

this.setEnable(false);

alert("The page exceeds the specified range");

}

else

window.location.href="${servletURL}?reportlet=fenye.cpt&op=write&page=" page//If it is not less than 1, it is normal Jump, otherwise the displayed page exceeds the specified range and this control setting cannot be used.

The third current page that can be jumped:

var toolbar = contentPane.toolbar;

var items = toolbar.options.items;

var customButton=items[2];

var inner = customButton.$table;

var btnWrapper = $("em", inner);

var $input = $("input", btnWrapper);

//Get this control

$input.blur(function(){

var toolbar = contentPane.toolbar;

var items = toolbar.options.items;

var customButton=items[2];

var inner = customButton.$table;

var btnWrapper = $ ("em", inner);

var $input = $("input", btnWrapper);

var page=$input.val();

var total=$("tr[tridx=0]","div.content-container").children().eq(2).html();

if (total>parseInt(total)) {total=parseInt(total) 1;

}

if(parseInt(page) > parseInt(total) || parseInt(page) < parseInt(1) )

{

alert("The number of pages you output is no longer within the specified range");

}

else

window.location. href="${servletURL}?reportlet=fenye.cpt&op=write&page=" page

});

//Is the value entered after losing focus within the specified range? If When jumping to the specified page, just put the URL after else, otherwise a message indicating that your output page is incorrect will be output. Losing focus means clicking elsewhere or clicking the TAB key.

Fourth slash:
This is handled during load time. No processing required here.
Fifth total page count:
This is handled during load time. No processing required here.
The sixth next page:
var page= $("tr[tridx=0]","div.content-container").children().eq(1).html();
var total=$("tr[tridx=0]","div.content-container").children().eq(2).html();
//JQURUY Take the next page and total Number of pages
if (total>parseInt(total)){total=parseInt(total) 1;
}
//Determine whether the total number of pages is an integer, not plus one
if(parseInt( page) > parseInt(total))
{
this.setEnable(false);
alert("The number of pages exceeds the specified range");
}
else
window .location.href="${servletURL}?reportlet=fenye.cpt&op=write&page=" page
//If the next page is in this range, jump there


This control is not available Used, the output is wrong.
The seventh last page:
The code is as follows:
var total=$("tr[tridx=0]","div.content-container").children().eq(2). html();
//Get the total number of pages.
if (total>parseInt(total)){total=parseInt(total) 1;
}
window.location.href="${servletURL}?reportlet=fenye.cpt&op=write&page=" total
//Determine whether the total number of pages is an integer, not plus one, and jump to the last page.
The name of the display control needs to be added to the alias

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? How to use CSS3 and JavaScript to achieve the effect of scattering and enlarging the surrounding pictures after clicking? Apr 05, 2025 am 06:15 AM

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...

HTML, CSS, and JavaScript: Essential Tools for Web Developers HTML, CSS, and JavaScript: Essential Tools for Web Developers Apr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

How to distinguish between closing a browser tab and closing the entire browser using JavaScript? How to distinguish between closing a browser tab and closing the entire browser using JavaScript? Apr 04, 2025 pm 10:21 PM

How to distinguish between closing tabs and closing entire browser using JavaScript on your browser? During the daily use of the browser, users may...

See all articles