yii2

Calling Javascript from dynamic form button in yii2

≯℡__Kan透↙ 提交于 2019-12-24 20:40:31
问题 In Yii2 Dynamic form, I have add-item and remove-item button to add a new row or remove a particular row. What I want is to call a javascript function on click of the remove item button. Dynamic Form Code - <?= $form->field($modelsProductsales, "[{$i}]productname")->widget(Select2::classname(), [ 'data' => ArrayHelper::map(Productbatch::find()->orderBy('productname')->all(),'productname','productname'), 'language' => 'en', 'options' => ['placeholder' => 'Select Product', 'onchange' =>

How to Modify ToolTips in Yii2 using dosamigos\chartjs\ChartJs?

拈花ヽ惹草 提交于 2019-12-24 20:03:05
问题 I want to change the tooltip of a Chart I made in Yii2 using dosamigos\chartjs\ChartJs which is based on Chart.js My problem comes when I try to modify the Tooltip part of the chart. I am unable to achieve it. I have tried using multiTooltipTemplate, tooltips.callback and tooltipTemplate properties but I have not succeeded yet. Below are 2 pictures of my Chart, What I want to achive is this: The ToolTip of the inner chart (first image) should say something like this: "A: 119 Products" or "B:

Yii2: Use Html::tag() with HTML content for tooltip Bootstrap 3

雨燕双飞 提交于 2019-12-24 18:40:18
问题 Hint: Formating as raw won't fix my problem - See attachement respectively picture: The following code will implement tooltip using attribute title of method tag() . Unfortunately, there is no possibility rendering HTML-tags inside the title. Any ideas(links are welcome) how to implement tooltip handling my intention to render HTML tags? Is there any other option implementing tooltip-box outside attribute title , so that I am able to render HTML-tags [ 'attribute' => $dummy, 'label' => Yii::t

Yii2 Search model without using GridView

空扰寡人 提交于 2019-12-24 16:58:23
问题 There is a serch form on the mainpage of a realestate agency. The data about objects is stored in the table "realty" that uses relations. For example, there are related tables category (residential, commercial, land plots), deal (buy, sell, rent), object_type (apartment, house, office). Then different categories have different properties and and there are three bootstrap tabs in the search form: residential, commercial, land plots. Under each tab there are selects and input fields that are

yii2 fullcalendar add a popup to element

北城以北 提交于 2019-12-24 16:44:13
问题 I was able to add the event description using the code <script> var JSEventClick = (function(calEvent, jsEvent, view) { for (var element of document.getElementsByClassName('fc-title')) { element.innerHTML += calEvent.nonstandard.field1 } }); </script> using the help from answer from this link - yii2 Fullcalendar - Why is alert for CalEvent working but not for updating innerHtml? Now I am trying to add the same as popup on mouseover event. <?= \yii2fullcalendar\yii2fullcalendar::widget(array(

how to use multilanguage in yii2? [duplicate]

試著忘記壹切 提交于 2019-12-24 16:37:08
问题 This question already has an answer here : Yii2 translation does not work (1 answer) Closed 4 years ago . How to create multilanguage app in yii2? Is there any preinstall message in yii2? config: 'language' => 'es', 'components' => [ 'i18n' => [ 'translations' => [ 'app*' => [ 'class' => 'yii\i18n\PhpMessageSource', //'basePath' => '@app/messages', 'sourceLanguage' => 'ru-RU', 'fileMap' => [ 'app' => 'app.php', 'app/error' => 'error.php', ], ], ], ], view : echo \Yii::t('app', 'I am a message

How to add valueless attribute to <form> tag using yii2 ActiveForm

。_饼干妹妹 提交于 2019-12-24 16:25:21
问题 How do I add a value-ess attribute to the form tag? I want to have: <form data-abide > according to: http://foundation.zurb.com/sites/docs/abide.html I've tried <?php $form = ActiveForm::begin(['id' => 'contact-form', 'options'=>['data-abide'=>'']]); ?> but get output: <form data-abide="ak8hvf-abide" > 回答1: Try this: 'options'=>['data-abide'=>true] Reference: In the framework helper BaseHtml.php file, find : function renderTagAttributes Where : foreach ($attributes as $name => $value) {if (is

How to atomatically apply migrations that comes from Yii2 extensions

放肆的年华 提交于 2019-12-24 16:05:19
问题 I have installed an extension for Yii2 dektrium/yii2-user using composer using it's "require" section. This extension contains migrations for database. Is it possible to apply migrations from this extension using console syntax not like this: php yii migrate --migrationPath=@dektrium/yii2-user/migrations but run all migrations automatically by using a simple command like: php yii migrate Is it possible to tell composer where the concrete extension contains it's migrations? 回答1: If you want to

How to send Yii2 RESTful GET request and specify sorting as params

耗尽温柔 提交于 2019-12-24 15:37:49
问题 I want to send GET request to v1/users endpoint, where as params I want to specify that I want to do ordering by priority DESC and status ASC . As you can see I want to send params that will map to SQL WHERE parts: SELECT * FROM table WHERE something ORDER BY priority DESC, status ASC How I am supposed to specify as params in my HTTP request that I want this sorting ? I think that in order to do this I need to send JSON data in POST request. But that is a problem, because I want GET request

URL Routing - yii-basic-app - Yii2

天大地大妈咪最大 提交于 2019-12-24 15:11:09
问题 i was trying to pass ID in URL. I was getting difficulty to do it. So, i was going through tutorials like Larry Ullman - URL Routing. My problem is: I created confirm.php page and created a controller too but error like NOT FOUND (#404) coming. SiteController.php <?php namespace app\controllers; use Yii; use yii\filters\AccessControl; use yii\web\Controller; use yii\filters\VerbFilter; use yii\swiftmailer\Mailer; use app\models\LoginForm; use app\models\ContactForm; use app\models\EntryForm;