Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
systems:yii2:examples [2018/05/31 15:20]
smayr [Modal Window]
systems:yii2:examples [2018/10/04 17:05] (current)
ajdavis [Copy to Clipboard using Javascript]
Line 1658: Line 1658:
             'createdAtAttribute' => 'created_at', // OR 'create_time', to override default field name             'createdAtAttribute' => 'created_at', // OR 'create_time', to override default field name
             'updatedAtAttribute' => 'updated_at', // OR 'update_time', to override default field name             'updatedAtAttribute' => 'updated_at', // OR 'update_time', to override default field name
-            'value' => new \yii\db\Expression('NOW()'),+            'value' => new \yii\db\Expression('NOW()'),  // for PHP/SQL datetime field 
 +            //'value' => time(),                         // for epoch time (unix) field
         ],         ],
         [         [
Line 2958: Line 2959:
 $dataProviderPrice->pagination->pageSizeLimit   = false; $dataProviderPrice->pagination->pageSizeLimit   = false;
 </code>         </code>        
 +
 +== Copy to Clipboard using Javascript ==
 +
 + # Add a reference to the //ClipboardJS// library either by using Yii2 registerJsFile or adding the file to ''assets\AppAsset.php''
 + # Add javascript to your page that creates an instance of ClipboardJS:
 +<code php>$this->registerJs("var clipboard = new ClipboardJS('.btn-clip');", \yii\web\View::POS_END);</code>
 + # Add a button that follows this logic:
 +<code html>
 +<i class="fa fa-copy btn btn-default btn-clip" data-clipboard-text="value-to-copy"></i>
 +</code>