From c63f0518d7ea565649d08a43ac3561a33b6a994b Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 20 Sep 2012 12:08:47 +0530 Subject: [PATCH] removed zoom from grid report --- erpnext/stock/page/stock_ledger/stock_ledger.js | 2 -- public/js/all-app.js | 7 +++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/erpnext/stock/page/stock_ledger/stock_ledger.js b/erpnext/stock/page/stock_ledger/stock_ledger.js index 72d02b1fc7..3f6d4a5284 100644 --- a/erpnext/stock/page/stock_ledger/stock_ledger.js +++ b/erpnext/stock/page/stock_ledger/stock_ledger.js @@ -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) { diff --git a/public/js/all-app.js b/public/js/all-app.js index c7f904b449..68f70b560e 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -1094,13 +1094,12 @@ this.make();this.show_zero=$('.show-zero input:checked').length;this.load_filter ').appendTo(this.wrapper);this.wrapper.find(".grid-report-export").click(function(){return me.export();});this.grid_wrapper=$("
").appendTo(this.wrapper);this.id=wn.dom.set_unique_id(this.grid_wrapper.get(0));$('').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) +
').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('

You must have Flash 10 installed to download this file.

');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){$('
'+contents+'
').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){$('
'+contents+'
').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;$('zoom in').appendTo(plot_area).click(function(e){e.preventDefault();me.plot.zoom();});$('zoom out').appendTo(plot_area).click(function(e){e.preventDefault();me.plot.zoomOut();});function addArrow(direction,style,offset){var t=$('').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