Answer the question
In order to leave comments, you need to log in
Yii ajax CJuiDatePicker and dropDownList?
yii 1.1.16
tell me how to update the content block in the least labor-intensive way when selecting a date in the datepicker and/or selecting a shift in the drop-down list?
UPD
c dropDownList sort of figured out the
twist
echo CHtml::dropDownList('listname',$mysmen,
array('1' => '1 смена', '2' => '2 смена','3' => '3 смена'),
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('quality/smen'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
'update'=>'#content', //selector to update
'data' => array
(
'smen' => 'js:this.value',
)
//leave out the data key to pass all form values through
)));
public function actionSmen()
{
$smen = Yii::app()->request->getParam('smen');
$model=new Quality('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Quality']))
$model->attributes=$_GET['Quality'];
$this->renderPartial('admin',array(
'model'=>$model,
));
}
(isset($_POST['smen'])) ? $mysmen =$_POST['smen']: $mysmen = today_smen($todaysmen);
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'from_date',
'value' => $date,
'language' => 'ru',
'options' => array(
'showAnim' => 'fold',
'dateFormat' => 'yy-mm-dd',
'onSelect' => 'js: function(dateText, inst) {window.location.search = "date=" + this.value; return false;}',
),
));
Answer the question
In order to leave comments, you need to log in
Print the value of input.prop('files') to the console, is there definitely something there?
Are the files already selected?
Or is it done on page load?
dropDownList
c dropDownList sort of figured it out
twist
echo CHtml::dropDownList('listname',$mysmen,
array('1' => '1 смена', '2' => '2 смена','3' => '3 смена'),
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('quality/smen'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
'update'=>'#content', //selector to update
'data' => array
(
'smen' => 'js:this.value',
)
//leave out the data key to pass all form values through
)));
public function actionSmen()
{
$smen = Yii::app()->request->getParam('smen');
$model=new Quality('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Quality']))
$model->attributes=$_GET['Quality'];
$this->renderPartial('admin',array(
'model'=>$model,
));
}
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'from_date',
'value' => $date,
'language' => 'ru',
'options' => array(
'showAnim' => 'fold',
'dateFormat' => 'yy-mm-dd',
//'onSelect' => 'js: function(dateText, inst) {window.location.search = "date=" + this.value; return false;}',
'onSelect' => 'js: function(dateText, inst) {' .
CHtml::ajax(array('type' => 'POST', 'datatype' => 'html', 'url' => array('Reports_ajax'),
'data' => array('date' => 'js: dateText'),
'success' => 'function(html){ $("#content").html(html);
return false; }'
)
) .
'}',
),
));
public function actionSmen()
{
$smen = Yii::app()->request->getParam('smen');
$smen = Yii::app()->request->getParam('date');
$model=new Quality('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Quality']))
$model->attributes=$_GET['Quality'];
$this->renderPartial('admin',array(
'model'=>$model,
));
}
(isset($_POST['date']) && $_POST['date']) ? $date = $_POST['date'] : $date = date('Y-m-d');
there is an onSelect event for CJuiDatePicker
'onSelect'=> 'js: function(dateText, inst) {
//тут ajax запрос и обновление контента , либо другая работа
}',
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question