yii2-advanced-app

Yii2 associative array

旧时模样 提交于 2020-08-10 19:13:12
问题 I have a query from which I am getting an array. $mData = \Yii::$app->db->createCommand("SELECT s.slab_start, s.slab_end, s.rate, r.cust_id FROM mdc_tariff_slabs s INNER JOIN mdc_meter_cust_rel r ON s.t_id = r.tariff_id WHERE r.cust_id = $consumer_no")->queryAll(); By var_dump($mData) I am getting array(3) { [0]=> array(3) { ["slab_start"]=> string(1) "1" ["slab_end"]=> string(3) "100" ["rate"]=> string(2) "10" } [1]=> array(3) { ["slab_start"]=> string(3) "101" ["slab_end"]=> string(3) "150"

Yii2- insert value to text input field on button click via jquery

会有一股神秘感。 提交于 2020-08-10 18:12:36
问题 I am working on yii2 . I have created a dynamic form. I have some fields in it. <div class="pull-right"> <button type="button" id="addBtn" class="add-item btn btn-success btn-xs"><i class="glyphicon glyphicon-plus"></i></button> <button type="button" id="remBtn" class="remove-item btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button> </div> <div class="row"> <div class="col-sm-3"> <?= $form->field($modelTariffSlabs, "[{$i}]slab_name")->textInput(['readonly'=>true,'value'=>

Yii2- insert value to text input field on button click via jquery

孤者浪人 提交于 2020-08-10 18:12:13
问题 I am working on yii2 . I have created a dynamic form. I have some fields in it. <div class="pull-right"> <button type="button" id="addBtn" class="add-item btn btn-success btn-xs"><i class="glyphicon glyphicon-plus"></i></button> <button type="button" id="remBtn" class="remove-item btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button> </div> <div class="row"> <div class="col-sm-3"> <?= $form->field($modelTariffSlabs, "[{$i}]slab_name")->textInput(['readonly'=>true,'value'=>

Jquery add 1 against each text input in yii2 dynamic form

霸气de小男生 提交于 2020-08-05 06:39:12
问题 The bounty expires in 5 hours . Answers to this question are eligible for a +100 reputation bounty. Faisal is looking for an answer from a reputable source . I already have added one question related to it. But there is a little change this time. I have a readonly text input with a default value 1 . <?= $form->field($modelTariffSlabs, "[{$i}]slab_start")->textInput(['readonly'=>true,'value'=>'1','maxlength' => 10,"class"=>"form-control js-slab-start"]) ?> Also, I have another text input which

Jquery add 1 against each text input in yii2 dynamic form

我怕爱的太早我们不能终老 提交于 2020-08-05 06:39:09
问题 The bounty expires in 5 hours . Answers to this question are eligible for a +100 reputation bounty. Faisal is looking for an answer from a reputable source . I already have added one question related to it. But there is a little change this time. I have a readonly text input with a default value 1 . <?= $form->field($modelTariffSlabs, "[{$i}]slab_start")->textInput(['readonly'=>true,'value'=>'1','maxlength' => 10,"class"=>"form-control js-slab-start"]) ?> Also, I have another text input which

How to properly view table data using if statement in yii2

蓝咒 提交于 2020-07-31 04:11:40
问题 I am working on yii2 . I have a page in which I have created a table. Now I want to put some data into it via my database query using if....else statement. <tbody style="text-align: center; line-height: 12px"> <?php $bd = $dataProvider2->getModels(); foreach ($bd as $a) { $strt =$a['slab_start']; $end = $a['slab_end']; $rate = $a['rate']; if ($end !='') { echo "<tr> <td>".print_r($strt).".".print_r('-').".".print_r($end)."</td> <td>".print_r($rate)."</td> </tr>"; } else { echo "<tr> <td>"

How to pass node id for each node clicked in kartik treeview?

社会主义新天地 提交于 2020-07-03 13:08:54
问题 I have multiple nodes. I want to show different views on each node click. For this, I have to pass the node id. Below is my code in which I have tried to explain the total scenario `<?= TreeView::widget([ 'query' => \common\models\MdcNode::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Root'], 'rootOptions' => ['label'=>'<span class="text-primary">Root</span>'], 'topRootAsHeading' => true, // this will override the headingOptions //'displayValue' => 1, // initial display

How to pass node id for each node clicked in kartik treeview?

折月煮酒 提交于 2020-07-03 13:05:16
问题 I have multiple nodes. I want to show different views on each node click. For this, I have to pass the node id. Below is my code in which I have tried to explain the total scenario `<?= TreeView::widget([ 'query' => \common\models\MdcNode::find()->addOrderBy('root, lft'), 'headingOptions' => ['label' => 'Root'], 'rootOptions' => ['label'=>'<span class="text-primary">Root</span>'], 'topRootAsHeading' => true, // this will override the headingOptions //'displayValue' => 1, // initial display