doc/book/devweb/ajax.rst
author Simon Chabot <simon.chabot@logilab.fr>
Wed, 12 Feb 2020 13:58:17 +0100
changeset 12890 0cd5b9057202
parent 12856 a82e56d4814a
permissions -rw-r--r--
[pyramid, predicate] Add a predicate that matches if the pattern is an eid in the DB
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8128
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     1
.. _ajax:
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     2
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     3
Ajax
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     4
----
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
     5
12856
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
     6
.. warning::
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
     7
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
     8
    This approach is deprecated in favor of using
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
     9
    `cwclientlibjs <https://www.npmjs.com/package/@logilab/cwclientlibjs>`_.
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
    10
    If your use react for your UI, try the react components from the
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
    11
    `cwelements <https://www.npmjs.com/package/@logilab/cwelements>`_ library.
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
    12
    The documentation is kept here as reference.
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
    13
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
    14
    For historical reference of what Ajax is and used to be, one can read the
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
    15
    `wikipedia article about Ajax <https://en.wikipedia.org/wiki/Ajax_(programming)>`_.
a82e56d4814a [doc/book/devweb/ajax] warning about deprecated use of ajax
Arthur Lutz <arthur.lutz@logilab.fr>
parents: 10491
diff changeset
    16
8128
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    17
CubicWeb provides a few helpers to facilitate *javascript <-> python* communications.
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    18
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    19
You can, for instance, register some python functions that will become
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    20
callable from javascript through ajax calls. All the ajax URLs are handled
8480
086cff6a306a [book] fix build warnings/errors. Closes #2430042
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents: 8128
diff changeset
    21
by the :class:`cubicweb.web.views.ajaxcontroller.AjaxController` controller.
8128
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    22
0a927fe4541b [controllers] deprecate JSonController and implement AjaxController / ajax-func registry (closes #2110265)
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
diff changeset
    23
.. automodule:: cubicweb.web.views.ajaxcontroller