Component YiiBooster datepickerRow does not show calendar - yii-components

I'm newie developing with Yii PHP framework and YiiBootstrap, I have a problem when I'm trying to use the datepickerRow component, the calendar does not showed when the cursor focus the field. Somebody know why?. This is the code that I'm using.
<?php echo $form->datepickerRow($model, 'publication_date',
array('prepend'=>'<i class="icon-calendar"></i>'
, 'options'=>array( 'format' => 'dd/mm/yyyy',
'weekStart'=> 1,)
)
);
?>
Thanks in advance.

Because the Calendar shows on click not on focus for more info http://jqueryui.com/datepicker/

Related

How to set items per page dropdown in grid view for yii

I want to set items per page dropdown in yii gridview.
What changes i need to do this? Has anyone had implemented this type of functionality before?
You have to add summaryText entry to the gridview as below.
$pageSize=Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']);
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider_countries,
'summaryText'=>'Displaying {start}-{end} of {count} result(s). ' .
CHtml::dropDownList(
'pageSize',
$pageSize,
Yii::app()->params['pageSizeOptions'],
array('class'=>'change-pageSize')) .' rows per page',
Result is similar to following.

yii cgridview tooltip php variable

This is my one of the Cgridview Column
array( 'name'=>'furnished',
'type'=>'raw',
'value'=>'$data->furnished=="FF" ? CHtml::link(CHtml::encode($data->furnished),
"tooltip",["title"=>"**Here I Want to show <?php echo $data->anystring ?>**", "data-toggle"=>"tooltip",
"style"=>"text-decoration: none; cursor:pointer;"]) : $data->furnished',
),
How can I achieve this . Please help
normally typed data is displayed here. but how to show PHP variable
Thanks In advance
Everything in value will be executed via PHP's eval() function. So you must change your code to this:
'value'=>'$data->furnished=="FF" ? CHtml::link(CHtml::encode($data->furnished),
"tooltip",["title"=>"**Here I Want to show ".$data->anystring."**", "data-toggle"=>"tooltip",
"style"=>"text-decoration: none; cursor:pointer;"]) : $data->furnished'
Actually, you don't need <?php and all you need is just ..

Creating dropdown list from related table

I have a two tables:
tbl_day:id_day,mon,tues,wed,thurs,fri,sat,sun
tbl_shft:shft_id,start,end,name,status
I want to have a dropdown table in tbl_day where mon is dependent in the tbl_shft name.
I come up with a dropdown that is displaying data from shift. what I did is.
<?php echo $form->labelEx($model,'sun'); ?>
<?php echo CHtml::activeDropDownList($model,'sun',$model -> getCategories(),array('prompt'=>'Select a Shift'))
?>
and for my model
public function getCategories(){
//this function returns the list of categories to use in a dropdown
return CHtml::listData(Shift::model()->findAll(), 'shft_id', 'name');}
My problem is that it is not submitting. I dont know where my problem here is. Im a beginner in Yii. Hope someone helps. Thanks in advance.
In here your code will work. I think the submitted output was not handled correctly. #sam dark says correctly. Edit your question .just place the controller action of your process . Else you just place this code on your controller action. And give the result of controller on this question itself.
Public function actionYouraction(){
......
if(isset($_POST))
{
echo "<pre>";
print_r($_POST);
exit(); } }

Default select one item in the dropDownList Yii

I have a dynamic dropdown, data coming from the database.
<?php $sel_id = $selected_id_array[0]->UPR_RelationType;?>
My dropdowm looks like this
<?php echo CHtml::dropDownList('RelationType_'.$pat_id[0]->PAT_ID,'U2U_RelationType',CHtml::listData(MasterTypeItems::model()->findAllByAttributes(array('MSTT_MST_ID'=>$relationship_type_array[0]->MST_ID),array('order' => 'MSTT_Name')), 'MSTT_ID', 'MSTT_Name'),array('id'=>'select','class'=>'relation_type','style'=>'width:50px'));
In this dropdown i have to select defaultly $sel_id;
for example am getting $sel_id=5; In the drop down i have to select 5th option as selected in yii. please give me any suggestion what i have to write in dropDown to select $sel_id;
If I understand your question correctly, what you want to achieve is a dropdownlist which already has a pre-selected option. If so, then this piece of code should work.
echo dropDownList(string $name, string $select, array $data, array $htmlOptions=array ( ))
where $select would be your default selected item.
More information can be found here: http://www.yiiframework.com/doc/api/1.1/CHtml#dropDownList-detail

Yii Cgridview Erases JS On Refresh

I'm using bootstrap and Bootstrap Editable extension in my GridView to edit data fast. It's awesome, but when I somehow refresh my gridview with AJAX (e.g. apply some fiter or delete a row) it dissapears from the page and if I want to edit-in-place again I have to refresh page manually (F5). This is how I apply editable plugin in my views/admin.php file:
Yii::app()->clientScript->registerScriptFile(
Yii::app()->assetManager->publish(
Yii::getPathOfAlias('ext.editable.assets.js').'/bootstrap-editable.min.js'
),
CClientScript::POS_HEAD
);
Yii::app()->clientScript->registerCssFile(
Yii::app()->assetManager->publish(
Yii::getPathOfAlias('ext.editable.assets.css').'/bootstrap-editable.css'
),
CClientScript::POS_HEAD
);
Yii::app()->clientScript->registerScript('editable', '$(".editable").editable();', CClientScript::POS_END);
Yii::app()->clientScript->registerCss('popover', '.popover{width: 600px !important;} .editable-popover{width: auto !important;}', CClientScript::POS_HEAD);
It's kind of messy, but I'm just trying to get it working.
Appreciate any help.
Try looking at http://www.yiiframework.com/doc/api/1.1/CGridView#afterAjaxUpdate-detail
ie.
'afterAjaxUpdate' => 'function() { $(".editable").editable(); }'