Browse Source

[minor] set filter in query report for checkbox

version-14
Nabin Hait 11 years ago
parent
commit
0f4fadf1ba
2 changed files with 23 additions and 8 deletions
  1. +12
    -1
      public/js/wn/ui/appframe.js
  2. +11
    -7
      public/js/wn/views/query_report.js

+ 12
- 1
public/js/wn/ui/appframe.js View File

@@ -275,12 +275,17 @@ wn.ui.AppFrame = Class.extend({
.appendTo(this.parent.find(".appframe-form .container"))
.find("input");
},
add_break: function() {
// add further fields in the next line
this.parent.find(".appframe-form .container")
.append('<div class="clearfix invisible-xs"></div>');
},
add_field: function(df) {
this.show_form();
var f = wn.ui.form.make_control({
df: df,
parent: this.parent.find(".appframe-form .container"),
only_input: true,
only_input: df.fieldtype=="Check" ? false : true,
})
f.refresh();
$(f.wrapper)
@@ -292,6 +297,12 @@ wn.ui.AppFrame = Class.extend({
})
.attr("title", wn._(df.label)).tooltip();
f.$input.attr("placeholder", wn._(df.label));
if(df.fieldtype==="Check") {
$(f.wrapper).find(":first-child")
.removeClass("col-md-offset-4 col-md-8");
}
if(df["default"])
f.set_input(df["default"])
this.fields_dict[df.fieldname || df.label] = f;


+ 11
- 7
public/js/wn/views/query_report.js View File

@@ -111,14 +111,18 @@ wn.views.QueryReport = Class.extend({
this.clear_filters();
var me = this;
$.each(wn.query_reports[this.report_name].filters || [], function(i, df) {
var f = me.appframe.add_field(df);
$(f.wrapper).addClass("filters pull-left");
me.filters.push(f);
if(df["default"]) {
f.set_input(df["default"]);
}
if(df.fieldtype==="Break") {
me.appframe.add_break();
} else {
var f = me.appframe.add_field(df);
$(f.wrapper).addClass("filters pull-left");
me.filters.push(f);
if(df["default"]) {
f.set_input(df["default"]);
}
if(df.get_query) f.get_query = df.get_query;
if(df.get_query) f.get_query = df.get_query;
}
});
this.set_filters_by_name();
},


Loading…
Cancel
Save