A review of the FineU framework Grid multi-header aggregate row export Excel, fineugrid

Source: Internet
Author: User

A review of the FineU framework Grid multi-header aggregate row export Excel, fineugrid

Years ago, I encountered such a problem when I used FineUI for development. The Grid multi-header aggregate rows cannot be exported. I went to the official example and found the export example for multiple headers. At that time, in order to save trouble, I copied and pasted it directly without carefully studying the code. Later, I checked that the problem of multiple headers was solved, and the problem of total rows was still not solved.

The problem was temporarily put there because we had to catch up with the process. After a long time, we forgot the problem. This week, the project was tested and accepted to discover the problem again (fortunately, the customer did not find it, ). I accidentally debugged it yesterday and found that count only has 16 data records. In addition, 17 data records should exist in the total row. After carefully reading the code, the code in the original official example did not write the code for exporting the total line.

It's easy to find out the problem. Sort out the ideas, first get the data of the total row and save it as Json, and then get the ID of all the columns in the Grid, finally, determine whether the node with this ID exists in the Json Of the total row. If yes, the node is empty if no data is written.

The following code is attached:

1 sb. Append ("<tr>"); 2 JObject summarty = grid. SummaryData; // get the total row data 3 if (summarty! = Null & summarty. ToString ()! = "") // Determines whether the total row data is null 4 {5 foreach (GridColumn column in mht. columns) // traverse the id 6 {7 if (summarty. property (column. columnID. toString () = null | summarty. property (column. columnID. toString ()). toString () = "") // determines whether the total line of Json exists on this node 8 {9 sb. appendFormat ("<td> {0} </td>", ""); // null if not 10} 11 else12 {13 sb. appendFormat ("<td >{0} </td>", summarty [column. columnID. toString ()]. toString (); // write data 14} 15} 16} 17 sb if any. append ("</tr> ");

As for the export of multiple headers, I will not explain or attach the code. I will directly reference the sanshi blog. Http://www.cnblogs.com/sanshi/p/4104411.html

  

The first time I wrote a blog, I am not writing well. If you have any problems, I hope you can point it out. Thank you very much! As a new employee, I would like to say hello to my predecessors.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.