Project Summary-jQuery EasyUI-DataGrid Table Partitioning and viewing details

Source: Internet
Author: User


Summary

In the previous article, we introduced how to dynamically display the table header. in the previous article, we also mentioned a problem that the data displayed by the DataGrid is not directly from the database but merged, how is this table spliced? This time we will learn its specific implementation.

 


Implementation


The function to be implemented is, the "data entry status" and "computing status" in the table are determined by some information in the database to obtain the "completed", "unfinished", "computing "," not calculated ", in addition, the table contains "View Details". You can click View Details to redirect to different conditions.

 

We will show the effect again,

 


 

Page after jump



 

 

The specific implementation of the Code is as follows. The code for the front-end html page has been written in the previous article "Project Summary-jQuery EasyUI-DataGrid dynamic loading table Header, let's focus on the implementation of general processing programs.

 

 

// Query public voidQueryCityCharacterization (HttpContext context) {// declare and instantiate the County/City qualitative data input table Signature = new CityCharacterizationVotesBLL (); // declare and instantiate the qualitative indicator CharacterizationTargetBLLcharacterizationTargetBLL = new CharacterizationTargetBLL (); // declare and instantiate the qualitative score of the county and city, namely, new CityCharacterizationScoresBLL (); // The first step is to obtain all the assessed qualitative indicator names. Table DataSet ds = characterizationTargetBLL. getClassTargetName (); DataTable dt = ds. tables [0]; var count = dt. rows. count; DataTable dtPart = new DataTable (); // name of the table header column dtPart. columns. add ("Name"); dtPart. columns. add ("ConditionInput"); dtPart. columns. add ("CalculateInput"); dtPart. columns. add ("Operate"); // retrieve the names of the evaluated qualitative indicators. All indicators in the table are named for (int I = 0; I <count; I ++) {var Name = dt. rows [I] ["Na Me "]. toString (); // The second step uses a loop to join the table // call a method to obtain the boolean value of the input condition Boolean fag = cityCharacterizationVotesBLL. getNotInputCityBoolean (Name); // call a method to obtain the boolean value of computation. Boolean Calculate = cityCharacterizationScoresBLL. getCityScoresBoolean (Name); // Add the record to the DataRow dr = dtPart. newRow (); dr ["Name"] = Name; dr ["ConditionInput"] = fag? "Completed": "Not completed"; dr ["CalculateInput"] = Calculate? "Calculated": "Not calculated"; dr ["Operate"] = "<a href = 'scoresdetailscitycharacterization. aspx? Name = "+ Name +" 'target = '_ blank'> View Details </a> "; dtPart. rows. add (dr) ;}// place dtPart in dataset DataSet dsCadres = new dataset (); dsCadres. tables. add (dtPart); int n = dtPart. rows. count; string strJson = ToJson. dataset2Json (dsCadres, n); // converts DataSet data to Json data context. response. write (strJson); // return it to the context on the foreground page. response. end ();}

 

 

This is the core code of the function we want to implement. Other code is mentioned in the previous article. The above code is the specific implementation of our results.

 

 

Summary

The core of this article is to combine tables and construct different data into a new able. However, I have made a special fight, this table not only contains data from a column in the database, but also determines the content to be displayed based on the column content in the database and a jump to "View Details, this is relatively troublesome. If we can even master this, other tables will be even more difficult.

 

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.