How to implement JQueryMiniUI query based on time
This article mainly brings you an implementation method of JQueryMiniUI querying according to time. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.
The assessment matter has changed to last year. At that time, I wanted to build a library management system. However, when searching according to time, the front-end data could not be transferred to the back-end, so part of it was lost. , re-watching it now, it’s actually nothing more than mediocre, but I have a feeling that it was just in vain at the time. Okay, so how to transfer the time data from the foreground to the background? In fact, it doesn’t matter if it is a normal transfer, because there are special functions that are implemented during search
So to pass data when loading the page, how to implement jQuery-MINI UI:
In fact, what we have to do is to display the data into the table, then we It depends on how it is implemented at the beginning:
The front desk is the same:
<p id="datagrid1" class="mini-datagrid" style="width: 1000px; height: 280px;" url="../index?method=listAll" idField="id" multiSelect="true" sizeList="[5,10,15]" pageSize="10" > <p property="columns"> <p type="checkcolumn"></p> <p type="indexcolumn">序号</p> <p field="bookGuid" width="60" headerAlign="center" allowSort="true">图书编号</p> <p field="bookName" width="60" headerAlign="center" allowSort="true">图书名称</p> <p field="bookType" class="mini-combobox" width="60" renderer="onTypeRenderer">图书类别</p> <p field="suitable" width="60" renderer="onSuitRenderer">适合人群</p> <p field="buyDate" width="150" headerAlign="center" dateFormat="yyyy-MM-dd HH:mm:ss" allowSort="true">入库日期</p> <p field="count" width="60" style="color:red">借阅次数</p> <p field="remark" width="60" style="color:red">备注</p> <p name="action" width="120" headerAlign="center" align="center" renderer="onActionRenderer" cellStyle="padding:0;">操作</p> </p> </p>
The above is what our table shows, mini- ui will initialize the form when the page is loaded, so in p we have a url attribute, which tells us the source of the data
url="../index?method=listAll"
is loaded on the page When calling back the listAll method, we will also call this method when searching, but we will pass the data to the background.
So how should we write it in js? First, let’s see if we don’t need to pass data. Go to the background, how to load this form
var grid = mini.get("datagrid1"); grid.load();
So when we click search, do we need to transfer the data to the background:
function search() { var type1 = mini.get("type1").getValue(); var date1=mini.get("date1").getValue(); var timestamp = Date.parse(date1); grid.load({ type1:type1, timestmp:timestamp }); }
According to the above, we can judge the received data in the background listAll, and then display the corresponding data
There is a characteristic in this place that the transfer of time is not based on yyyy- In the format of MM-dd, the timestamp is used to transmit to the background, which means that a long type of data is passed. Let’s take a look at how the background receives it
public void listAll(HttpServletRequest request, HttpServletResponse response) throws Exception{ String type=request.getParameter("type1"); String lstr=request.getParameter("timestmp"); long time=0; if(lstr!=null && isNumeric(lstr)){ time=Long.parseLong(lstr); } Date date1=new Date(); date1.setTime(time); Date date2=new Date(); date2.setTime(time+24*60*60*1000); SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); String sql="select * from bookinfo"; if(type!= null && type.length()>0 && time==0) { sql="select * from bookinfo where booktype="+Integer.parseInt(type); } else if(time!=0 && type.length()==0) { sql ="select * from bookinfo where buydate between \""+ sdf.format(date1) +"\" and \""+sdf.format(date2)+"\""; } else if(time!=0 && type.length()>0) { sql ="select * from bookinfo where booktype="+Integer.parseInt(type)+" and buydate between \""+ sdf.format(date1) +"\" and \""+sdf.format(date2)+"\""; } else { sql ="select * from bookinfo"; } System.out.println(sql); //要知道的是联合查询中需要得到的List也是显示出来的 List list=mdao.getList(sql); //实现的是分页 int pageSize=Integer.parseInt(request.getParameter("pageSize")); int pageIndex=Integer.parseInt(request.getParameter("pageIndex")); List sub_list=new ArrayList<>(); int start=pageIndex*pageSize; for(int i=start;i<list.size() && i<start+pageSize;i++) { sub_list.add(list.get(i)); } String json=JsonUtil.listToJson(sub_list, "yyyy-MM-dd hh:mm:ss"); System.out.println(json); json=JsonData.modifyJson(json); json=json.replaceFirst("null", list.size()+""); response.getWriter().write(json); }
Then the timestamp is converted into a certain format in the background, and we can search in the database. In addition, double quotes are required on both sides of the time in the SQL statement.
In short, we useJQuerymini-uiWhen transferring data and time, if If we only pass a time, the format of the time is not as satisfactory as we want, and we have to make various judgments in the background. Now we pass the timestamp, which will reduce some judgments, and the format of the time can also be easily changed. Make the conversion.
Related recommendations:
thinkphp+Jquery MiniUI development management system
##thinkphp+Jquery MiniUI development management system, thinkphpjquery
jquery miniui tutorial table control merge cell application_jquery
The above is the detailed content of How to implement JQueryMiniUI query based on time. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Download the latest version of 12306 ticket booking app. It is a travel ticket purchasing software that everyone is very satisfied with. It is very convenient to go wherever you want. There are many ticket sources provided in the software. You only need to pass real-name authentication to purchase tickets online. All users You can easily buy travel tickets and air tickets and enjoy different discounts. You can also start booking reservations in advance to grab tickets. You can book hotels or special car transfers. With it, you can go where you want to go and buy tickets with one click. Traveling is simpler and more convenient, making everyone's travel experience more comfortable. Now the editor details it online Provides 12306 users with a way to view historical ticket purchase records. 1. Open Railway 12306, click My in the lower right corner, and click My Order 2. Click Paid on the order page. 3. On the paid page

How to check my academic qualifications on Xuexin.com? You can check your academic qualifications on Xuexin.com, but many users don’t know how to check their academic qualifications on Xuexin.com. Next, the editor brings you a graphic tutorial on how to check your academic qualifications on Xuexin.com. Interested users come and take a look! Xuexin.com usage tutorial: How to check your academic qualifications on Xuexin.com 1. Xuexin.com entrance: https://www.chsi.com.cn/ 2. Website query: Step 1: Click on the Xuexin.com address above to enter the homepage Click [Education Query]; Step 2: On the latest webpage, click [Query] as shown by the arrow in the figure below; Step 3: Then click [Login Academic Credit File] on the new page; Step 4: On the login page Enter the information and click [Login];

MySQL and PL/SQL are two different database management systems, representing the characteristics of relational databases and procedural languages respectively. This article will compare the similarities and differences between MySQL and PL/SQL, with specific code examples to illustrate. MySQL is a popular relational database management system that uses Structured Query Language (SQL) to manage and operate databases. PL/SQL is a procedural language unique to Oracle database and is used to write database objects such as stored procedures, triggers and functions. same

If you want to check the activation date using an Apple mobile phone, the best way is to check it through the serial number in the mobile phone. You can also check it by visiting Apple's official website, connecting it to a computer, and downloading third-party software to check it. How to check the activation date of Apple mobile phone Answer: Serial number query, Apple official website query, computer query, third-party software query 1. The best way for users is to know the serial number of their mobile phone. You can see the serial number by opening Settings, General, About This Machine. . 2. Using the serial number, you can not only know the activation date of your mobile phone, but also check the mobile phone version, mobile phone origin, mobile phone factory date, etc. 3. Users visit Apple's official website to find technical support, find the service and repair column at the bottom of the page, and check the iPhone activation information there. 4. User

Title: How to use Oracle to query whether a table is locked? In Oracle database, table lock means that when a transaction is performing a write operation on the table, other transactions will be blocked when they want to perform write operations on the table or make structural changes to the table (such as adding columns, deleting rows, etc.). In the actual development process, we often need to query whether the table is locked in order to better troubleshoot and deal with related problems. This article will introduce how to use Oracle statements to query whether a table is locked, and give specific code examples. To check whether the table is locked, we

Forum is one of the most common website forms on the Internet. It provides users with a platform to share information, exchange and discuss. Discuz is a commonly used forum program, and I believe many webmasters are already very familiar with it. During the development and management of the Discuz forum, it is often necessary to query the data in the database for analysis or processing. In this article, we will share some tips for querying the location of the Discuz database and provide specific code examples. First, we need to understand the database structure of Discuz

Check the latest price of BitTorrent Coin (BTT) BTT is a cryptocurrency on the TRON blockchain that is used to reward BitTorrent network users for sharing and downloading files. Here's how to find the latest price for BTT: Choose a reliable price check website or app. Some commonly used price query websites include: CoinMarketCap: https://coinmarketcap.com/Coindesk: https://www.coindesk.com/Binance: https://www.binance.com/ Search on the website or app BTT. Check out the latest prices for BTT. Note: Cryptocurrency Prices

Recently, "Black Myth: Wukong" has attracted huge attention around the world. The number of people online at the same time on each platform has reached a new high. This game has achieved great commercial success on multiple platforms. The Xbox version of "Black Myth: Wukong" has been postponed. Although "Black Myth: Wukong" has been released on PC and PS5 platforms, there has been no definite news about its Xbox version. It is understood that the official has confirmed that "Black Myth: Wukong" will be launched on the Xbox platform. However, the specific launch date has not yet been announced. It was recently reported that the Xbox version's delay was due to technical issues. According to a relevant blogger, he learned from communications with developers and "Xbox insiders" during Gamescom that the Xbox version of "Black Myth: Wukong" exists.
