-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add jquery ui doc * Update recipe_jquery_ui.rst
- Loading branch information
1 parent
be46a40
commit bdc065f
Showing
5 changed files
with
46 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
Jquery UI | ||
========= | ||
|
||
The admin only comes with the `Jquery UI Sortable plugin`_. | ||
|
||
Adding another jQuery UI plugin | ||
------------------------------- | ||
|
||
To add another jQuery UI plugin in your admin, you have to tell | ||
webpack encore to not provide another instance of jQuery thanks | ||
to the `addExternals` method: | ||
|
||
.. code-block:: javascript | ||
// webpack.config.js | ||
let Encore = require('@symfony/webpack-encore'); | ||
Encore | ||
.addExternals({ jquery: 'jQuery' }) | ||
.addEntry('sonata', './assets/js/sonata.js') | ||
And then adding the one you need in your own js files (don't forget to load it in your template): | ||
|
||
.. code-block:: javascript | ||
// assets/js/sonata.js | ||
import $ from 'jquery'; | ||
import 'jquery-ui/ui/widget'; | ||
import 'jquery-ui/ui/widgets/draggable'; | ||
$('.foo').draggable(); // The new UI plugin can be used. | ||
$('.bar').sortable(); // The already loaded by sonata plugin can be used too. | ||
.. _`Jquery UI Sortable plugin`: https://jqueryui.com/sortable/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters