Display a table using easyui and use easyuitable

Source: Internet
Author: User

Display a table using easyui and use easyuitable

1. Before using easyui, you must import the compressed js package of easy-ui.

2. Introduce

The procedure is as follows:

<title>Basic Panel - jQuery EasyUI Demo</title><link rel="stylesheet" type="text/css"    href="/script/jquery-easyui-1.5.2/themes/default/easyui.css"><link rel="stylesheet" type="text/css" href="/script/jquery-easyui-1.5.2/themes/icon.css"><script type="text/javascript" src="/script/jquery-easyui-1.5.2/jquery.min.js"></script><script type="text/javascript" src="/script/jquery-easyui-1.5.2/jquery.easyui.min.js"></script>

3. Prepare the data and create a table in the database for the object to be represented as a table. It is best to have the same name as the object attribute in the database.

In this way, you can avoid mistakes caused by carelessness.

4. Create a DataGrid to display user information.

<Th field = "firstname" width = "50"> First Name </th>

The field value refers to the property value of the object. Therefore, the field is followed by the object property as fistname (fistname is an attribute of the user) in the preceding example ).

The First Name indicates the column Name in the table, which can be any value in theory, but we usually give it a very intuitive column Name based on specific requirements.

<table id="dg" title="My Users" class="easyui-datagrid" style="width:550px;height:250px" url="get_users.php" toolbar="#toolbar" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="firstname" width="50">First Name</th> <th field="lastname" width="50">Last Name</th> <th field="phone" width="50">Phone</th> <th field="email" width="50">Email</th> </tr> </thead> </table> <div id="toolbar"> <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">New User</a> <a href="#" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">Edit User</a> <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyUser()">Remove User</a> </div>

Here we can display a table without writing any JavaScript code, such:

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.