Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
systems:yii2:examples [2018/05/31 15:17] smayr [Modal confirmation called from GridView] |
systems:yii2:examples [2018/10/04 17:05] (current) ajdavis [Copy to Clipboard using Javascript] |
||
---|---|---|---|
Line 1530: | Line 1530: | ||
=== Modal Window === | === Modal Window === | ||
- | + | * See: [[systems: | |
- | <code php> | + | |
- | <?php | + | |
- | // | + | |
- | // Image | + | |
- | // | + | |
- | $itemImage = (!empty($model-> | + | |
- | Yii:: | + | |
- | '' | + | |
- | ); | + | |
- | + | ||
- | // | + | |
- | // Image Thumbnail | + | |
- | // | + | |
- | if(!empty($itemImage)) { | + | |
- | echo "< | + | |
- | } else { | + | |
- | echo "< | + | |
- | base64_encode(\app\models\Tool:: | + | |
- | } | + | |
- | + | ||
- | + | ||
- | echo Html:: | + | |
- | [' | + | |
- | ); | + | |
- | + | ||
- | // | + | |
- | // Modal to view image | + | |
- | // | + | |
- | yii\bootstrap\Modal:: | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ], | + | |
- | ]); | + | |
- | + | ||
- | if(!empty($itemImage)) { | + | |
- | echo "< | + | |
- | } else { | + | |
- | echo "< | + | |
- | base64_encode(\app\models\Tool:: | + | |
- | } | + | |
- | echo '< | + | |
- | echo ' | + | |
- | echo '</ | + | |
- | + | ||
- | yii\bootstrap\Modal:: | + | |
- | ?> | + | |
- | </ | + | |
- | + | ||
- | ==== Modal called from GridView ==== | + | |
- | Modal to view or update a record, called from a '' | + | |
- | <code php> | + | |
- | <?= yii\grid\GridView:: | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | // record number column | + | |
- | [' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | // | + | |
- | [ | + | |
- | ' | + | |
- | //' | + | |
- | ' | + | |
- | ' | + | |
- | | + | |
- | }, | + | |
- | ' | + | |
- | | + | |
- | }, | + | |
- | ], | + | |
- | ], | + | |
- | ], | + | |
- | ]) ?> | + | |
- | + | ||
- | <?php | + | |
- | // Attach click events to buttons ' | + | |
- | $this-> | + | |
- | " | + | |
- | $(' | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | }); | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | }); | + | |
- | }); | + | |
- | "); | + | |
- | ?> | + | |
- | + | ||
- | <?php | + | |
- | // Modal for VIEW | + | |
- | yii\bootstrap\Modal:: | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | //' | + | |
- | ' | + | |
- | ]); | + | |
- | echo "< | + | |
- | yii\bootstrap\Modal:: | + | |
- | ?> | + | |
- | + | ||
- | <?php | + | |
- | // Modal for UPDATE | + | |
- | yii\bootstrap\Modal:: | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | //' | + | |
- | ' | + | |
- | ]); | + | |
- | echo "< | + | |
- | yii\bootstrap\Modal:: | + | |
- | ?> | + | |
- | </ | + | |
- | + | ||
- | See also: [[http:// | + | |
- | + | ||
- | ==== Modal confirmation called from GridView ==== | + | |
- | | + | |
Line 1789: | Line 1658: | ||
' | ' | ||
' | ' | ||
- | ' | + | ' |
+ | //' | ||
], | ], | ||
[ | [ | ||
Line 3089: | Line 2959: | ||
$dataProviderPrice-> | $dataProviderPrice-> | ||
</ | </ | ||
+ | |||
+ | == Copy to Clipboard using Javascript == | ||
+ | |||
+ | # Add a reference to the // | ||
+ | # Add javascript to your page that creates an instance of ClipboardJS: | ||
+ | <code php> | ||
+ | # Add a button that follows this logic: | ||
+ | <code html> | ||
+ | <i class=" | ||
+ | </ |