Browse Source

[IMP] using qweb template in _format function instead of return the html part directly

pull/351/head
Cesar Lage 8 years ago
parent
commit
46bd506729
  1. 9
      web_widget_radio_tree/static/src/js/widget.js
  2. 3
      web_widget_radio_tree/static/src/xml/widget.xml

9
web_widget_radio_tree/static/src/js/widget.js

@ -6,11 +6,10 @@ openerp.web_widget_radio_tree = function (instance) {
instance.web.list.RadioTreeColumn = instance.web.list.Column.extend({
_format: function (row_data, options) {
return _.template(
'<input type="radio" name="<%-name%>" <%-checked%> readonly="readonly"></input>', {
name: options.model + '_' + this.id,
checked: row_data[this.id].value ? 'checked' : '',
});
return QWeb.render('RadioTreeColumn', {
name: options.model + '_' + this.id,
checked: row_data[this.id].value ? {checked: ''} : {},
});
}
});

3
web_widget_radio_tree/static/src/xml/widget.xml

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates>
<t t-name="RadioTreeColumn"
><input type="radio" t-att-name="name" t-att="checked" readonly="readonly"></input>
</t>
<t t-name="RadioTree">
<span class="oe_form_field oe_form_field_boolean oe_form_field_boolean_radio"
t-att-style="widget.node.attrs.style">

Loading…
Cancel
Save