removed zoom from grid report
This commit is contained in:
parent
09d686f7f6
commit
c63f0518d7
@ -175,8 +175,6 @@ wn.pages['stock-ledger'].onload = function(wrapper) {
|
||||
min: dateutil.str_to_obj(this.from_date).getTime(),
|
||||
max: dateutil.str_to_obj(this.to_date).getTime(),
|
||||
},
|
||||
zoom: {interactive: true},
|
||||
pan: {interactive: true}
|
||||
}
|
||||
},
|
||||
get_tooltip_text: function(label, x, y) {
|
||||
|
@ -1094,13 +1094,12 @@ this.make();this.show_zero=$('.show-zero input:checked').length;this.load_filter
|
||||
</div>').appendTo(this.wrapper);this.wrapper.find(".grid-report-export").click(function(){return me.export();});this.grid_wrapper=$("<div style='height: 500px; border: 1px solid #aaa; \
|
||||
background-color: #eee; margin-top: 15px;'>").appendTo(this.wrapper);this.id=wn.dom.set_unique_id(this.grid_wrapper.get(0));$('<div style="margin: 10px 0px; text-align: right; display: none" class="show-zero">\
|
||||
<input type="checkbox"> Show rows with zero values\
|
||||
</div>').appendTo(this.wrapper);this.bind_show();wn.cur_grid_report=this;this.apply_filters_from_route();$(this.wrapper).trigger('make');},apply_filters_from_route:function(){var hash=window.location.hash;var me=this;if(hash.indexOf('/')!=-1){$.each(hash.split('/').splice(1).join('/').split('&'),function(i,f){var f=f.split("=");if(me.filter_inputs[f[0]]){me.filter_inputs[f[0]].val(decodeURIComponent(f[1]));}else{console.log("Invalid filter: "+f[0]);}});}else{this.init_filter_values();}},set_route:function(){wn.set_route(wn.container.page.page_name,$.map(this.filter_inputs,function(v){var val=v.val();var opts=v.get(0).opts;if(val&&val!=opts.default_value)
|
||||
</div>').appendTo(this.wrapper);this.bind_show();wn.cur_grid_report=this;this.apply_filters_from_route();$(this.wrapper).trigger('make');},apply_filters_from_route:function(){var hash=decodeURIComponent(window.location.hash);var me=this;if(hash.indexOf('/')!=-1){$.each(hash.split('/').splice(1).join('/').split('&'),function(i,f){var f=f.split("=");if(me.filter_inputs[f[0]]){me.filter_inputs[f[0]].val(decodeURIComponent(f[1]));}else{console.log("Invalid filter: "+f[0]);}});}else{this.init_filter_values();}},set_route:function(){wn.set_route(wn.container.page.page_name,$.map(this.filter_inputs,function(v){var val=v.val();var opts=v.get(0).opts;if(val&&val!=opts.default_value)
|
||||
return encodeURIComponent(opts.fieldname)
|
||||
+'='+encodeURIComponent(val);}).join('&'))},render:function(){this.grid=new Slick.Grid("#"+this.id,this.dataView,this.dataview_columns,this.options);var me=this;this.dataView.onRowsChanged.subscribe(function(e,args){me.grid.invalidateRows(args.rows);me.grid.render();});this.dataView.onRowCountChanged.subscribe(function(e,args){me.grid.updateRowCount();me.grid.render();});this.add_grid_events&&this.add_grid_events();},prepare_data_view:function(items){this.dataView=new Slick.Data.DataView({inlineFilters:true});this.dataView.beginUpdate();this.dataView.setItems(items);if(this.dataview_filter)this.dataView.setFilter(this.dataview_filter);this.dataView.endUpdate();},export:function(){var me=this;var res=[$.map(this.columns,function(v){return v.name;})].concat(this.get_view_data());wn.require("js/lib/downloadify/downloadify.min.js");wn.require("js/lib/downloadify/swfobject.js");var id=wn.dom.set_unique_id();var msgobj=msgprint('<p id="'+id+'">You must have Flash 10 installed to download this file.</p>');Downloadify.create(id,{filename:function(){return me.title+'.csv';},data:function(){return wn.to_csv(res);},swf:'js/lib/downloadify/downloadify.swf',downloadImage:'js/lib/downloadify/download.png',onComplete:function(){msgobj.hide();},onCancel:function(){msgobj.hide();},onError:function(){msgobj.hide();},width:100,height:30,transparent:true,append:false});return false;},render_plot:function(){var plot_data=this.get_plot_data?this.get_plot_data():null;if(!plot_data){this.wrapper.find('.plot').toggle(false);return;}
|
||||
wn.require('js/lib/flot/jquery.flot.js');var plot_options=this.get_plot_options();var plot_area=this.wrapper.find('.plot');if(plot_options.zoom)wn.require('js/lib/flot/jquery.flot.navigate.js');this.plot=$.plot(plot_area.toggle(true),plot_data,plot_options);this.setup_plot_hover();if(plot_options.zoom)this.setup_plot_zoom(plot_area);},setup_plot_hover:function(){var me=this;this.tooltip_id=wn.dom.set_unique_id();function showTooltip(x,y,contents){$('<div id="'+me.tooltip_id+'">'+contents+'</div>').css({position:'absolute',display:'none',top:y+5,left:x+5,border:'1px solid #fdd',padding:'2px','background-color':'#fee',opacity:0.80}).appendTo("body").fadeIn(200);}
|
||||
wn.require('js/lib/flot/jquery.flot.js');this.plot=$.plot(this.wrapper.find('.plot').toggle(true),plot_data,this.get_plot_options());this.setup_plot_hover();},setup_plot_hover:function(){var me=this;this.tooltip_id=wn.dom.set_unique_id();function showTooltip(x,y,contents){$('<div id="'+me.tooltip_id+'">'+contents+'</div>').css({position:'absolute',display:'none',top:y+5,left:x+5,border:'1px solid #fdd',padding:'2px','background-color':'#fee',opacity:0.80}).appendTo("body").fadeIn(200);}
|
||||
this.previousPoint=null;this.wrapper.find('.plot').bind("plothover",function(event,pos,item){if(item){if(me.previousPoint!=item.dataIndex){me.previousPoint=item.dataIndex;$("#"+me.tooltip_id).remove();showTooltip(item.pageX,item.pageY,me.get_tooltip_text(item.series.label,item.datapoint[0],item.datapoint[1]));}}
|
||||
else{$("#"+me.tooltip_id).remove();me.previousPoint=null;}});},setup_plot_zoom:function(plot_area){var me=this;$('<span class="link_type">zoom in</span>').appendTo(plot_area).click(function(e){e.preventDefault();me.plot.zoom();});$('<span class="link_type">zoom out</span>').appendTo(plot_area).click(function(e){e.preventDefault();me.plot.zoomOut();});function addArrow(direction,style,offset){var t=$('<span><i class="icon icon-arrow-'+direction+'"></i></span>').appendTo(plot_area).click(function(e){e.preventDefault();me.plot.pan(offset);});}
|
||||
addArrow('left',"top:100px; left: 600px",{left:-100});addArrow('right',"top: 100px; left: 650px",{left:100});addArrow('up',"top: 50px; left: 625px",{top:-100});addArrow('down',"top: 150px; left: 625px",{top:100});},get_tooltip_text:function(label,x,y){var date=dateutil.obj_to_user(new Date(x));var value=fmt_money(y);return value+" on "+date;},get_view_data:function(){var res=[];var col_map=$.map(this.columns,function(v){return v.field;});for(var i=0,len=this.dataView.getLength();i<len;i++){var d=this.dataView.getItem(i);var row=[];$.each(col_map,function(i,col){var val=d[col];if(val===null||val===undefined){val=""}
|
||||
else{$("#"+me.tooltip_id).remove();me.previousPoint=null;}});},get_tooltip_text:function(label,x,y){var date=dateutil.obj_to_user(new Date(x));var value=fmt_money(y);return value+" on "+date;},get_view_data:function(){var res=[];var col_map=$.map(this.columns,function(v){return v.field;});for(var i=0,len=this.dataView.getLength();i<len;i++){var d=this.dataView.getItem(i);var row=[];$.each(col_map,function(i,col){var val=d[col];if(val===null||val===undefined){val=""}
|
||||
row.push(val);})
|
||||
res.push(row);}
|
||||
return res;},options:{editable:false,enableColumnReorder:false},apply_filters:function(item){var filters=this.filter_inputs;if(item._show)return true;for(i in filters){if(!this.apply_filter(item,i))return false;}
|
||||
|
Loading…
Reference in New Issue
Block a user