我使用Yii2默认GridView和我嵌入的kartik datepicker('attribute' => 'register_date',
'format' => ['date', 'dd.MM.Y'],
'headerOptions' => ['width'=>'120', 'style'=>'text-align:center'],
'filter' => DatePicker::widget([
'name' => 'register_date',
'language' => 'ru',
'type' => DatePicker::TYPE_INPUT,
'pluginOptions' => [
'autoclose'=>false,
'format' => 'yyyy-mm-dd',
]
])
)进入其中一个过滤输入,如下所示:
// path where your CSV file is located
define('CSV_PATH','C:\xampp\htdocs\form');
// Name of your CSV file
$csv_file = CSV_PATH . "test.csv";
if (($handle = fopen($csv_file, "r")) !== FALSE) {
fgetcsv($handle);
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
$num = count($data);
for ($c=0; $c < $num; $c++) {
$col[$c] = $data[$c];
}
$col1 = $col[0];
$col2 = $col[1];
$col3 = $col[2];
$query = "INSERT INTO csvTable(ID,Name,city) VALUES ('".$col1."','".$col2."','".$col3."')";
$params = array();
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$stmt = sqlsrv_query($conn, $query, $params, $options );
}
fclose($handle);
}
echo "File data successfully imported to database!!";
//mysql_close($connect);
?>
现在,如果我从DatePicker中选择日期,那么该页面只会重新加载并且不会过滤掉过滤器。我做错了什么?