|
@@ -100,6 +100,7 @@ wn.views.GridReport = Class.extend({ |
|
|
this.filter_inputs = {}; |
|
|
this.filter_inputs = {}; |
|
|
this.preset_checks = []; |
|
|
this.preset_checks = []; |
|
|
this.tree_grid = {show: false}; |
|
|
this.tree_grid = {show: false}; |
|
|
|
|
|
var me = this; |
|
|
$.extend(this, opts); |
|
|
$.extend(this, opts); |
|
|
|
|
|
|
|
|
this.wrapper = $('<div>').appendTo(this.parent); |
|
|
this.wrapper = $('<div>').appendTo(this.parent); |
|
@@ -109,8 +110,10 @@ wn.views.GridReport = Class.extend({ |
|
|
} |
|
|
} |
|
|
this.make_waiting(); |
|
|
this.make_waiting(); |
|
|
|
|
|
|
|
|
var me = this; |
|
|
|
|
|
this.get_data(); |
|
|
|
|
|
|
|
|
this.get_data(function() { |
|
|
|
|
|
me.apply_filters_from_route(); |
|
|
|
|
|
me.refresh(); |
|
|
|
|
|
}); |
|
|
}, |
|
|
}, |
|
|
bind_show: function() { |
|
|
bind_show: function() { |
|
|
// bind show event to reset cur_report_grid |
|
|
// bind show event to reset cur_report_grid |
|
@@ -123,11 +126,14 @@ wn.views.GridReport = Class.extend({ |
|
|
$(this.page).bind('show', function() { |
|
|
$(this.page).bind('show', function() { |
|
|
// reapply filters on show |
|
|
// reapply filters on show |
|
|
wn.cur_grid_report = me; |
|
|
wn.cur_grid_report = me; |
|
|
me.get_data() |
|
|
|
|
|
|
|
|
me.get_data(function() { |
|
|
|
|
|
me.apply_filters_from_route(); |
|
|
|
|
|
me.refresh(); |
|
|
|
|
|
}) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
get_data: function() { |
|
|
|
|
|
|
|
|
get_data: function(callback) { |
|
|
var me = this; |
|
|
var me = this; |
|
|
var progress_bar = null; |
|
|
var progress_bar = null; |
|
|
if(!this.setup_filters_done) |
|
|
if(!this.setup_filters_done) |
|
@@ -138,8 +144,7 @@ wn.views.GridReport = Class.extend({ |
|
|
me.setup_filters(); |
|
|
me.setup_filters(); |
|
|
me.setup_filters_done = true; |
|
|
me.setup_filters_done = true; |
|
|
} |
|
|
} |
|
|
me.apply_filters_from_route(); |
|
|
|
|
|
me.refresh(); |
|
|
|
|
|
|
|
|
callback(); |
|
|
}, progress_bar); |
|
|
}, progress_bar); |
|
|
}, |
|
|
}, |
|
|
setup_filters: function() { |
|
|
setup_filters: function() { |
|
@@ -387,22 +392,21 @@ wn.views.GridReport = Class.extend({ |
|
|
this.bind_show(); |
|
|
this.bind_show(); |
|
|
|
|
|
|
|
|
wn.cur_grid_report = this; |
|
|
wn.cur_grid_report = this; |
|
|
this.apply_filters_from_route(); |
|
|
|
|
|
$(this.wrapper).trigger('make'); |
|
|
$(this.wrapper).trigger('make'); |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
apply_filters_from_route: function() { |
|
|
apply_filters_from_route: function() { |
|
|
var hash = decodeURIComponent(window.location.hash); |
|
|
|
|
|
var me = this; |
|
|
var me = this; |
|
|
if(wn.route_options) { |
|
|
if(wn.route_options) { |
|
|
$.each(wn.route_options, function(key, value) { |
|
|
$.each(wn.route_options, function(key, value) { |
|
|
me.set_filter(key, value); |
|
|
me.set_filter(key, value); |
|
|
}); |
|
|
}); |
|
|
|
|
|
wn.route_options = null; |
|
|
} else { |
|
|
} else { |
|
|
this.init_filter_values(); |
|
|
this.init_filter_values(); |
|
|
} |
|
|
} |
|
|
this.set_default_values(); |
|
|
this.set_default_values(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(this.wrapper).trigger('apply_filters_from_route'); |
|
|
$(this.wrapper).trigger('apply_filters_from_route'); |
|
|
}, |
|
|
}, |
|
|
options: { |
|
|
options: { |
|
@@ -455,7 +459,9 @@ wn.views.GridReport = Class.extend({ |
|
|
if(item._show) return true; |
|
|
if(item._show) return true; |
|
|
|
|
|
|
|
|
for (i in filters) { |
|
|
for (i in filters) { |
|
|
if(!this.apply_filter(item, i)) return false; |
|
|
|
|
|
|
|
|
if(!this.apply_filter(item, i)) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|