Yii CListView summary text - yii

Is there any way to hide "Summary" for CListView without loosing pagination. By summary i mean text like "Displaying 1-2 of 2 result(s).". Or maybe I should use different widget?

Try the following to get more control over the look of your CListView output:
'template'=>'{items} {pager}'
You can even use HTML in the template.

Ok, I didn't get it at first, when looking into CListView code, but setting 'summaryText' to '' will do the work. I've realised that second time when I was staring at $summaryText === null
$this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider,
'summaryText'=>'',
'itemView'=>'_indexview',
));

Here is the example for CListView:
$this->widget('zii.widgets.CListView', array(
'dataProvider' => $dataProvider,
'itemView' => '_view',
'ajaxUpdate' => false,
'emptyText' => 'No records found.',
'summaryText' => "{start} - {end} из {count}",
'template' => '{summary} {sorter} {items} {pager}',
'sorterHeader' => 'Sort by:',
'sortableAttributes' => array('title', 'price'),
'pager' => array(
'class' => 'CLinkPager',
'header' => false,
'cssFile' => '/css/pager.css',
'htmlOptions' => array('class' => 'pager'),
'maxButtonCount' => '10',
'prevPageLabel'=>'←',
'nextPageLabel'=>'→',
'header'=>'Pages: ',
),
));

You should try this:
'summaryText' => FALSE,

You may hide it by adding CSS in the page like below.
<style>
.summary{
display:none;
}
</style>

Here is my suggestion
$this->widget('zii.widgets.CListView', array(
'dataProvider' => $best_seller_data,
'itemView' => 'alsoBestseller',
'summaryText'=>false,
));

Related

yii how to put link to another form in cgridview

how to put link in the classcode to proceed to another form
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'classlist-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
**'classCode'**,
'classDesc',
array(
'class'=>'CButtonColumn',
),
),
)); ?>
You can use a clink column
'columns'=>array(
.....
array(
'class'=>'CLinkColumn',
'label'=>'your_attribute',
'url'=>'your_controller/your_action&id='.$model->your_attribute,
'header'=>'your_column_header'
),
Hii you can also use this
array(
'name' => 'you_field',
'header' => 'label',
'type' => 'raw',
'value' => 'CHtml::link($data->you_field,Yii::app()->createUrl("controller/action",array("param"=>$data->you_field)),array("target"=>"_blank"))',
),
Hi use this code,
array(
'header' =>Your Header Name,
'value' => '$data->subject->subject_name." - ".$data->subject->subject_code',
'url' => 'Yii::app()->createUrl("core/subject/deleteelective", array("id"=>$data->electivesubjectid))',
'htmlOptions' => array('width' => '45%'),
),

CJuiDatePicker in yii is not working

In my web application, I want to implement a date field. For this i am using CJuiDatePicker. But for me it not showing calendar.
My code is,
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name' => 'Employee[employee_joiningdate]',
'id' => 'Employee_employee_joiningdate',
'value' => Yii::app()->dateFormatter->format("d-M-y", strtotime($model->employee_joiningdate)),
'options' => array(`
'showAnim' => 'slide', //'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop'
'showOtherMonths' => true, // Show Other month in jquery
'selectOtherMonths' => true, // Select Other month in jquery
),
'htmlOptions' => array(
'class' => 'form-control'
),
));`
What i am doing wrong?
Please help me....
Thanks in advance.

How to Configure yiibooster

thanks for reading, i am wondering how to install
YiiBooster
, do i need to install
YiiBootstrap
first ?
I want to install it by hand , is it enough to extract it to extensions folder and than configure the main.php or is there something i am missing ?
Also how can i make this point to the right path
'booster' => array(
'class' => 'path.alias.to.booster.components.Booster',
),
You don't need to install bootstrap. Yiibooster includes all bootstrap files it needs. Just download Yiibooster, unpack to the extension folder and add the below to your main config file,
'booster' => array(
'class' => 'ext.yiibooster.components.Bootstrap',
'responsiveCss' => true,
),
Then add the following in the preload section of the config,
'booster',
// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
// preloading 'log' component
'preload'=>array('log','bootstrap'),
// application components
'components'=>array(
//
'bootstrap' => array(
'class' => 'bootstrap.components.Booster',
'responsiveCss' => true,
),
Rename folder name yiibooster-4.0.1 to yiibooster
Step 1:
'preload' => array(
'booster',
),
Step 2:
'booster' => array(
'class' => 'ext.yiibooster.components.Booster',
'responsiveCss' => true,
),
Note: Booster this Class name
//Use view file
<?php
$this->widget('booster.widgets.TbExtendedGridView',
array(
'filter' => $model,
'fixedHeader' => true,
'type' => 'striped bordered',
'headerOffset' => 40,
// 40px is the height of the main navigation at bootstrap
'dataProvider' =>$model->search(),
'template' => "{items}",
'columns' => array(
'id',
'firstname',
'lastname',
'age',
'address',
'email',
),
)
);
?>

yiibooster show already added record in select2 widget

I have already added data using select2 yiibooster widget but how i can update data using select2 widget.
how i show already added records in yiibooster select2 widget
<?php
echo $form->labelEx($model, 'measurement');
$this->widget(
'bootstrap.widgets.TbSelect2', array(
'name' => 'measures[]',
'data' => Ingredient::getmeasurementhere(),
'htmlOptions' => array(
'multiple' => 'multiple',
'class' => 'span3',
'id' => 'select1li_id'
),
//'events' => array('change' => 'js:getsubcategories')
)
);
?>
i am getting data using Ingredient::getmeasurementhere() function how i fetch this using update or write new function but how to show in select2 ?
Thanks in advance

Zend_Form decorators ordering (Errors before form element issue)

I have the following Zend_Form code to apply to form element decorators:
$decorators = array(
'ViewHelper',
'Description',
array('break' => 'HtmlTag', array('tag' => 'br', 'openOnly'=>true)),
array('Label', array('class' => 'formLabel', 'separator'=>' ', 'requiredSuffix' => ' <em class="requiredFormElement">(requried)</em>', 'escape'=>false)),
array('Errors', array('class' => 'formErrors')),
array(array('row' => 'HtmlTag'), array('tag' => 'div')),
);
It seems no matter what I do I can't seem to make the Errors show up before the form element (and label) itself. Am I missing something? Everything else seems to be ordered correctly. Can this only be done with a custom decorator?
Thank you in advance.
Try the following, don't know if it'll work, since I don't have my laptop at the moment:
array('Errors', array('class' => 'formErrors', 'placement' => 'prepend'))