jQuery插件advTable好的用户表处理程序、可编辑内容、可选行、多选排、源选择(数据库或文件或HTML)、过滤的内容、密码保护的数据库更新超时、调整大小、HTML5日期选择。
//if table have children create from this or table dont have children crate from com.php with JSON or uploaded csv file see below.
//or load with this example method with my php class
require_once('mysql_db.php');
$db = Database::getInstance();
$db->connect();
$sql = "SELECT * FROM yourTable";
$table = $db->getHTMLtable($sql, 'yourId');
echo $table;
$db->disconnect();
?>
$(document).ready(function() {
// initialize with default setting $('#yourId').advTable() or add a new settings:
// This is default
$('#yourId').advTable({
src: 'database', // database is default else your uploaded file. Example 'upload/demo.csv'
name: "advTable", // Name required for table association in com.php file (com_mssql or com_mysql)
width: 1000, // table inner width numeric
height: 300, // table inner height numeric
delimiter: ';', // delimiter for csv file (download)
datePicker: true, // enable HTML5 date picker. Check field data. If this date or datetime then enable browser HTML5 datepicker.
buttons: { // handlers true:display, false:hide
addRow: true,
dellRow: true,
update: true,
reload: true,
search: true
},
php: {
id: 0, // unique database column index not editable
file: "com.php", // required for database handling (com_mssql or com_mysql)
user: "root", // add more user option (not working, yet)
timeout: 60000 // entered password timeout
}
});
});
// com php file configuration (bottom of the com php):
function assoc_table($value = '') {
$val = array();
if($value == 'advTable') {
$val['table'] = 'yourTable'; // configured name in script (name: "advTable") 'yourTable' is a real database table.
$val['pass'] ='admin'; // password for this table
}
return $val;
}
?>
// if you want change column name then add tags for this array(name_def.php):
$nevek = array(
'date' => 'Date',
'location' => 'Location',
'country_code' => 'Country code',
'country_name' => 'Country name',
'ip' => 'Ip address',
'id' => 'Identity',
'region' => 'Region',
'city' => 'City',
'postal_code' => 'Postal code',
'latitude' => 'Latitude',
'longitude' => 'Longitude'
);
?>
相关链接