allow multisort with selectable sort order

This commit is contained in:
Anand Doshi 2012-09-13 15:39:34 +05:30
parent 99e5ac3452
commit e08249f3d5
4 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@
{
'creation': '2012-09-13 15:18:44',
'docstatus': 0,
'modified': '2012-09-13 15:19:44',
'modified': '2012-09-13 15:38:45',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -23,8 +23,8 @@
'module': u'Stock',
'name': '__common__',
'page_len': 50,
'sort_by': u'`tabStock Ledger Entry`.`posting_date` DESC, `tabStock Ledger Entry`.`posting_time` DESC, `tabStock Ledger Entry`.`name` DESC',
'sort_order': u'DESC',
'sort_by': u'`tabStock Ledger Entry`.`posting_date`, `tabStock Ledger Entry`.`posting_time`, `tabStock Ledger Entry`.`name`',
'sort_order': u'ASC',
'standard': u'Yes'
},

View File

@ -400,7 +400,7 @@ wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,f
* lib/js/core.js
*/
if(!console){var console={log:function(txt){}}}
window._version_number="1e94c62f61174cfb7f98c2bdd377674ef06b81eff2e4d1c2dff88107";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
window._version_number="6123c7881505af8bdcadcac363d143df24a587186c90a50f40a97664";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
/*
* lib/js/legacy/globals.js

View File

@ -287,7 +287,7 @@ wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,f
* lib/js/core.js
*/
if(!console){var console={log:function(txt){}}}
window._version_number="1e94c62f61174cfb7f98c2bdd377674ef06b81eff2e4d1c2dff88107";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
window._version_number="6123c7881505af8bdcadcac363d143df24a587186c90a50f40a97664";$(document).ready(function(){wn.assets.check();wn.provide('wn.app');$.extend(wn.app,new wn.Application());});
/*
* lib/js/legacy/globals.js

View File

@ -171,7 +171,7 @@ _r.DataTable.prototype.set_asc=function(icon){this.sort_icon.src='images/lib/ico
_r.DataTable.prototype.set_sort_option_disabled=function(label,disabled){var s=this.sort_sel;if(disabled){for(var i=0;i<s.options.length;i++){if(s.options[i]&&s.options[i].text==label){this.disabled_options[label]=s.options[i];s.remove(i);}}}else{if(this.disabled_options[label]){try{s.add(this.disabled_options[label],s.options[s.options.length-1]);}catch(e){try{s.add(this.disabled_options[label],s.options.length-1);}catch(e){}}
this.disabled_options[label]=null;}}}
_r.DataTable.prototype.add_sort_option=function(label,val){var s=this.sort_sel;s.options[s.options.length]=new Option(label,val,false,s.options.length==0?true:false);}
_r.DataTable.prototype.update_query=function(no_limit){if((_r.rb_con.cur_rb&&_r.rb_con.cur_rb.get_query)||(this.search_criteria&&this.search_criteria.custom_query)){}else{var sort_by=null,sort_order="";if(sel_val(this.sort_sel)){sort_by=sel_val(this.sort_sel);sort_order=this.sort_order;}else if(_r.rb_con.cur_rb.sc.sort_by){sort_by=_r.rb_con.cur_rb.sc.sort_by;sort_order="";}else{this.sort_sel.selectedIndex=0;sort_by=sel_val(this.sort_sel);sort_order=this.sort_order;}
_r.DataTable.prototype.update_query=function(no_limit){if((_r.rb_con.cur_rb&&_r.rb_con.cur_rb.get_query)||(this.search_criteria&&this.search_criteria.custom_query)){}else{var me=this;var sort_by=null,sort_order="";if(sel_val(this.sort_sel)){sort_by=sel_val(this.sort_sel);sort_order=this.sort_order;}else if(_r.rb_con.cur_rb.sc.sort_by){sort_by=(_r.rb_con.cur_rb.sc.sort_by||"").split(",");sort_by=$.map(sort_by,function(v){return v.trim()+" "+(me.sort_order||"");}).join(", ");sort_order="";}else{this.sort_sel.selectedIndex=0;sort_by=sel_val(this.sort_sel);sort_order=this.sort_order;}
this.query+=NEWLINE
+' ORDER BY '+sort_by
+' '+sort_order;}