In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail the ways to take EasyUI DataGrid in PHP. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
EasyUI DataGrid is a DataGrid written in Jquery, it can be seen that it is a front-end Web UI technology, generally people in the generation of DataGrid should be more common is to use background language such as background PHP, to directly generate HTML syntax, to display DataGrid, when to operate on the DataGrid, in the transfer of parameters to the backend, re-generate the entire web page.
While EasyUI DataGrid supports two methods, one is that the background server produces the displayed HTML well and displays it to the front end. The other is to use AJAX to generate, that is, simply feed the JSON format data to the front end. After receiving the data, the front end uses JQuery to refresh the picture of this part of the DataGrid after analyzing the data.
Here is the second approach, using AJAX technology to do, this advantage is that the data layer-> control layer-> presentation layer three layers to operate independently, to achieve my previous multi-level architecture design foreword said the spirit, unlike the old method, the generation of HTML is generated in PHP, resulting in PHP developers themselves, but also to HTML and other front-end technology to understand the problem of development.
Another benefit of doing this is that your front-end UI is replaceable, while the daemon does not need to be greatly modified. At present, there are many JavaScript DataGrid that support JSON data format, you can also refer to the DataGrid provided by other companies and choose the most suitable one to use.
At this point, if you look directly at the code, you will know more about what I mean above:
First of all, we need to design the HTML UI interface to define which fields to display, the display name of the field, and so on. EasyUI DataGrid also provides the definition of this part of the field, using JavaScript to dynamically define it, but I am used to using HTML to define it directly, which is not complicated. Later, in terms of division of labor, it is relatively easy to directly give it to Web artists to operate directly.
This part focuses on the setting of URL.
DataGrid2.php
The copy code is as follows:
A little easyUI datagrid
A little easyUI datagrid url test
UNum
User ID
Password
Birthday
Nickname
DBSTS
To define the background interface for data acquisition
Datagrid2_getdata.php
The copy code is as follows:
From the above, we can see that this is a very simple action to obtain information.
At first, DataGrid will pass in two parameters.
$_ POST ['page']) which page is currently on
$_ POST ['rows']) how many pieces of data should be displayed on each page
Then, use an array $result to hold two pieces of information
$result ["total"] has several pieces of information
$result ["rows"] stores the actual data array set
Finally, the $result array will be generated to output the JSON data format, and the DataGrid will process and refresh the picture after it is received.
Later, and further, the datagrid2_getdata.php can be abstracted at the level of abstraction, that is, the part of the data format processing that belongs to EasyUI DataGrid is separated from the part accessed by the database, and each part is processed as two class.
A good architecture and class design are actually generated by the accumulation of experience, constantly evolving and improving, the original framework, the most important spirit of which is that the division of labor of each Class should be clear and precise, which is a corresponding measure to deal with the above-mentioned problems of continuous evolution, so that it is easier to make changes and adjustments in the future.
Otherwise, it is more likely to become, if you want to change, you do not know where to start, because there are dozens or even hundreds of programs waiting for you to modify together, thus extending the stability problem, that is, people are opposed to modifying the original system, just because there are too many changes, not even one less, dozens of problems will be changed together, even if they are all finished, who will test whether they have been changed or not? will you ask your user to help you test and think about it? Just forget it and don't change it any more. Anyway, the system is still in good use.
This is the end of this article on "what are the ways to get EasyUI DataGrid in PHP". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.