我目前正在我的应用程序中使用JQuery UI SelectMenu Widget。 selectMenu中的选项在运行时根据sql表中的某些值填充。
根据selectedMenu中选择的选项,需要在特定列上过滤数据表。
.Js片段
`<?php
include '/home/pi/vendor/autoload.php';
define('NET_SFTP_LOGGING', NET_SFTP_LOG_COMPLEX);
$sftp = new \phpseclib\Net\SFTP('192.168.100.20');
$key = new \phpseclib\Crypt\RSA();
$key->loadkey(file_get_contents('/home/pi/.ssh/id_rsa.pub'));
$key->loadkey(file_get_contents( '/home/pi/.ssh/id_rsa'));
if (!$sftp->login('vdar', $key)) {
exit('Login Failed');
}
echo $sftp->pwd() . "\r\n";
$filename='remoteTest.txt';
if($filename)
{
$local_file_path='localTest.txt';
$sftp->get($filename, $local_file_path);
}
else
{
echo "error download files";
}?>`
当选择某些内容时,上述方法有效,但在首次加载页面时不起作用,即在首次加载页面时不会过滤表格。
如何实现同样目标。
答案 0 :(得分:0)
使用以下方法解决了问题:
$(function() { // Shorthand for $(document).ready(function() {
var table = $('.tableContent').DataTable({...});
$('#osFamilySelect1').selectmenu({...});
table.column(9).search($('#osFamilySelect1').val(), false, true, true).draw();
});