title: odoo How to implement javascript/jquery on button?
body: <p>Hi i am using odoo 11 and ve added Button along Create and Import buttons. That button is Export button see figure for understanding:</p>
  
  <p><a href="https://i.stack.imgur.com/g5TlG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g5TlG.png" alt="enter image description here"></a></p>
  
  <p>Basically i am overriding and those Create and Import are in build. I placed them here bcz my custom button was replacing them so i also placed Create and Import along.
  But with respect to <strong>Export</strong> button and Jquery i ve problem that button does nt responds with jquery.</p>
  
  <p>My Modules and files
  <strong>web_export_view\web_export_view\static\src\xml\web_export_view_template.xml:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;templates id="template" xml:space="preserve"&gt;
  
  
  &lt;t t-name="ListView.buttons"&gt;
      &lt;div class="o_list_buttons"&gt;
          &lt;t t-if="widget.is_action_enabled('create')"&gt;
              &lt;button type="button" class="btn btn-primary btn-sm o_list_button_add" accesskey="c"&gt;
                  Create
              &lt;/button&gt;
          &lt;/t&gt;
          &lt;button type="button" class="btn btn-primary btn-sm o_list_button_save" accesskey="s"&gt;
              Save
          &lt;/button&gt;
          &lt;button type="button" class="btn btn-default btn-sm o_list_button_discard" accesskey="j"&gt;
              Discard
          &lt;/button&gt;
  
          &lt;button class="btn btn-default export_treeview_xls" value="hh" type="button" title="Export xls"&gt;
              Export
          &lt;/button&gt;
      &lt;/div&gt;
  &lt;/t&gt;
  
  
  &lt;/templates&gt;
  </code></pre>
  
  <p><strong>web_export_view\web_export_view\static\src\js\web_export_view.js</strong></p>
  
  <pre><code>odoo.define('web_export_view', function (require) {
  "use strict";
  
      var core = require('web.core');
      var ListView = require('web.ListView');
      var QWeb = core.qweb;
  
      var _t = core._t;
  
      ListView.include({
          redraw: function () {
              var self = this;
  
  
           events: {
           "click .export_treeview_xls": "your_function",
       },
  
       your_function: function () {
                alert('Button Clicked');
       },
  
      });
  });
  </code></pre>
  
  <p><strong>web_export_view\web_export_view\views\web_export_view_view.xml</strong></p>
  
  
  
  <pre><code>&lt;odoo&gt;
      &lt;template id="assets_backend" name="web_export_view assets" inherit_id="web.assets_backend"&gt;
          &lt;xpath expr="." position="inside"&gt;
              &lt;script type="text/javascript" src="/web_export_view/static/src/js/web_export_view.js"&gt;&lt;/script&gt;
          &lt;/xpath&gt;
      &lt;/template&gt;
  &lt;/odoo&gt;
  </code></pre>
  
  <p><strong>web_export_view\manifest</strong></p>
  
  <pre><code>{
      'name': 'Web Export Current View',
      'version': '10.0.1.0.0',
      'category': 'Web',
      'author': 'Me',
  
      'depends': [
          'web',
      ],
      "data": [
          'views/web_export_view_view.xml',
      ],
      'qweb': [
          "static/src/xml/web_export_view_template.xml",
      ],
      'installable': True,
      'auto_install': False,
  }
  </code></pre>