$.pjax.reload({
container:'.grid-view',
url: $('.grid-view li.active a').attr('href')
});
Here I Wish to Share some Tutorials For web Development, especially Php, MySql, JavaScript, Node js, Angular js
Wednesday, 11 October 2017
Yii2 Pjax Reload Grid view and stay on same page
Yii2 Query Builder Like operator
To use "LIKE" operator in Yii2 query builder, use the below code,
$sql = "SELECT * FROM TABLE_NAME WHERE item_code = :item_code AND DATE_FORMAT(req_date, '%Y-%m') LIKE :period";
$req_date = '%' . $req_date . '%';
$command = Yii::$app->db->createCommand($sql);
$command->bindParam('item_code', $item_code);
$command->bindParam('period', $req_date);
$result = $command->execute();
Yii2 Sum Column in Active Record
To get sum of column using active record,
$query = Item::find();
$query->where(['item_code' => $item_code]);
$cost = $query->sum('lot_qty');
Subscribe to:
Posts (Atom)