This lesson focuses on how the DataGrid (data table) component is used in Easyui, which relies on
Panel, resizeable (resizing), LinkButton (button), pageination (pagination) components.
A Query function
Toolbar settings
<div id= "TB" style= "Padding:5px;height:auto" >
<div style= "margin-bottom:5px" >
<a href= "#" class= "Easyui-linkbutton" iconcls= "Icon-add"
Plain= "true" > Add </a>
<a href= "#" class= "Easyui-linkbutton" iconcls= "Icon-edit"
Plain= "true" > Modify </a>
<a href= "#" class= "Easyui-linkbutton" iconcls= "Icon-remove"
Plain= "true" > Delete </a>
</div>
<div style= "padding:0 0 0 7px; " >
Enquiry Account: <input class= "textbox" name= "User"
style= "width:110px" >
Creation time from: <input class= "Easyui-datebox" name= "Date_from"
style= "width:110px" >
To: <input class= "Easyui-datebox" name= "date_to"
style= "width:110px" >
<a href= "#" class= "Easyui-linkbutton" iconcls= "Icon-search"
Onclick= "Obj.search ();" > Enquiry </a>
</div>
</div>
. textbox{
height:20px;
margin:0;
padding:0 2px;
Box-sizing:content-box;
}
Pass the value of the form
obj = {
Search:function () {
$ (' #box '). DataGrid (' Load ', {
User: $.trim ($ (' input[name= "" user "). Val ()),
Date_from: $ (' input[name= ' Date_from "]). Val (),
Date_to: $ (' input[name= ' date_to "]). Val (),
});
},
};
Server-side SQL consolidation
$sql = ";
$user = ";
$date _from = ";
$date _to = ";
if (Isset ($_post[' user ") &&!empty ($_post[' user ')) {
$user = "User like '%{$_post[' user ']}% ' and";
$sql. = $user;
}
if (Isset ($_post[' Date_from ')) &&!empty ($_post[' Date_from ']) {
$date _from = "date>= ' {$_post[' date_from ']} ' and ';
$sql. = $date _from;
}
if (Isset ($_post[' date_to ')) &&!empty ($_post[' date_to ']) {
$date _to = "date<= ' {$_post[' date_to ']} ' and ';
$sql. = $date _to;
}
if (!empty ($sql)) {
$sql = ' WHERE '. substr ($sql, 0,-4);
}
$query = mysql_query ("Select User,email,date from Think_user $sql ORDER
by $sort er LIMIT $first, $pageSize ") or Die (' SQL Error! ‘);
$total = mysql_num_rows (mysql_query ("Select User,email,date from
Think_user $sql "));
DataGrid (data table) component [4]