Quantcast
Browsing all 60 articles
Browse latest View live

YII cgridview Tricks

Yii cgridview make custom drop down filters, Yii cgridview set row color based on a condition, Yii cgridview add time picker in filter, Yii cgridview add drop down in colum valuesHere is an example how...

View Article


YII Client side form validation error doesn't prevent form submit

YII Client side form validation error doesn't prevent form submitTo get this behavior you just need to add 'clientOptions' => array('validateOnSubmit'=>true), to your configuration so it would...

View Article


Image may be NSFW.
Clik here to view.

YII CGRIDVIEW, Add form actions to cgridview

This is a tutorial for how to add input text-Field, check-box, buttons in CGridView.Scenario This is CRUD pages for admin menu management. So, Menu model have following things:menuId : INTmenuName :...

View Article

How to upload image(photo), and path entry in database with update functionality

View :Model :Controller :I saw many posts that community newbie is confuse in image/photo upload with random name. so I post this topic covering all useful things regarding to image/photo upload(not...

View Article

How to upload image(photo), and path entry in database with update functionality

View :Model :Controller :I saw many posts that community newbie is confuse in image/photo upload with random name. so I post this topic covering all useful things regarding to image/photo upload(not...

View Article


YII CGridView add a custom button like edit,delete,import etc

Add a custom button to YII CGridView like update,delete buttonsYou can use template property to change order of build-in buttons or add/remove new buttons like...

View Article

YII2 DB Count Results query

YII2 DB count results querySimple in the controller or view file add do this:$count=MODEL::find() ->select(['COUNT(id) AS cnt']) ->where([ 'field1'=> $value1, ])-> andWhere(['>',...

View Article

Yii2 query / query builder: how to use OR condition

Yii2 query / query builder: how to use OR conditionYou can use some thing like this:$third_res_count=CustomerReservedTimeslots::find() ->select(['COUNT(timeslot_id) AS cnt'])...

View Article


YII2 nav widget open link in new tab/window and how to link to external link

echo Nav::widget(['options'=> ['class'=> 'nav navbar-left nav-tabs'],'items'=> [ ['label'=> 'Schedule An Appointment', 'url'=> 'http://google.com','linkOptions'=> ['target'=>...

View Article


How to import an SQL file using the command line in MySQL?

How to import an SQL file using the command line in MySQL?mysql -u username -p database_name < /path/file.sqlIt will ask for password after this command

View Article

Yii 2.0: Displaying, Sorting and Filtering Model Relations on a GridView,...

One of the things you will find tricky to implement is the the sorting and filtering of a GridView's column that displays related model data.As you know if you have been playing with Yii2 lately, there...

View Article

Yii2 Gridview bulk action using checkbox column. How to properly create...

To add a CheckboxColumn to the yii\grid\GridView, add it to the columns configuration as follows:'columns' => [    // ...    [        'class' => 'yii\grid\CheckboxColumn',        // you may...

View Article

YII2 gridview how to add drop down in filter

['attribute'=>'column_name','filter'=>array("value1"=>"label1","value2"=>"label2","value3"=>"label3"),]

View Article


YII2 Gridview how to add jui datepicker in filter

['attribute'=> 'slot_date','value'=> 'slot_date','filter'=> \yii\jui\DatePicker::widget(['language'=> 'en','dateFormat'=> 'yyyy-MM-dd','model'=> $searchModel,'attribute'=>...

View Article

JQuery check if checkbox is checked or not

if($("#checkboxid").prop('checked')==true){//do something}

View Article


YII2 find value from db between a range

YII2 find value from db between a range$match_batches=Batches::find()->andFilterWhere( ['>','start_date', $temp_date_range_start] ) ->andFilterWhere( ['<','end_date', $temp_date_range_end]...

View Article

YII2 redirect to previous page or referrer

YII2 redirect to previous page or referrer$this->redirect(Yii::$app->request->referrer);

View Article


Yii2 REST API remove tag

$xml =new\yii\web\XmlResponseFormatter;$xml->rootTag ='Response';        Yii::$app->response->format ='custom_xml';Yii::$app->response->formatters['custom_xml']= $xml;...

View Article

YII2 form generate _csrf for form manually

YII2 form generate _csrf for form manually<form action='#' method='POST'><input type="hidden" name="_csrf" value="<?=Yii::$app->request->getCsrfToken()?>" /> ....</form>

View Article

Yii2: Using csrf token

Yii2: Using csrf tokenFirst, if you do not understand what is the CSRF token? and why should we use it, please refer to the following link...

View Article
Browsing all 60 articles
Browse latest View live