yii2


yii2: registerJs in view which is rendered without layout


Simple question, I think. Sometimes I render views without layout to produce code for popup div for example. If I need to associate js with this div, I usually store it in the same file, so js is loaded when needed with view and you don't need to store all js in one file. How to do it with yii2? As I can see, registerJs, registerJsFile here don't work, because view is rendered without layout. Thank you in advance!
Inspite of it You can use
renderAjax("view");
in your controller ..where you want to show pop - up read Render Ajax
Where in View you can use registerJs() without including in your Seprate JS File
Import in your view, another view with the script code with:
<?= $this->render('../views/script') ?>

Related Links

Yii Gridview show/hide columns from interface when filtering the records
Yii2 skip to other URL route if <controller>/<action> is not found
Include additional library to yii2
Yii2 make session works on all actions of one controller?
Yii2 display data from phpexcel in view before saving to database
yii2 dependant dropdown reset on edit action due to onchange function
Yii2 non-DB (or virtual) attribute isn't populated during massive assignment?
Yii2 Join multiple tables
Codeception Adding custom assert actions (functional testing)
Selected values in yii2
Yii queryBuilder; If dbexpression is not being quoted well
Time attribute validation in Yii2 framework
Yii2 kartik-datecontrol extension
SQL query help in Yii2
Yii2 Pjax inside ListView not working
how to get post value from multiple array in yii2

Categories

HOME
ionic-framework
hive
xmpp
framework7
kalman-filter
adfs
tomcat6
spring-xd
export-to-csv
google-cloud-ml
apache-cayenne
phaser
msp430
sms-gateway
firefox-webextensions
plunker
web-sql
blazemeter
angular2-aot
binary-data
atl
cloud-code
amazon-kinesis-kpl
bytecode-manipulation
jquery-bootgrid
xcode-extension
.net-4.6.2
avconv
hendrix
nstextview
snmptrapd
pearson
pdfclown
nbconvert
webdriverjs
android-fonts
underscore.js-templating
trash
skobbler-maps
ctest
simplewebrtc
react-native-listview
prettytensor
sdf
nessus
design-by-contract
uid
reactive-banana
thredds
python-3.2
wireshark-dissector
iis-arr
census
device-orientation
umbraco6
gwidgets
oxwall
gulp-less
contenttype
doskey
poller
jboss-weld
stxxl
sitemesh
dbconnection
pushbackinputstream
yui-compressor
sqlperformance
pygit2
flashvars
chuck
qt-jambi
pydot
hamachi
ecl
oncheckedchanged
jmock
lpeg
createwindow
digest-authentication
dentrix
bespin
firefox4
caching-application-block

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App