changes to make select field compatible to chosen
This commit is contained in:
parent
b3cb970eef
commit
d7f1bcbde6
@ -104,23 +104,40 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
||||
var $filter = me.filter_inputs.account;
|
||||
var company = $(this).val();
|
||||
var default_company = me.filter_inputs.company.get(0).opts.default_value;
|
||||
$filter.empty().add_options([$filter.get(0).opts.default_value].concat(
|
||||
var default_account = $filter.get(0).opts.default_value;
|
||||
var new_options = [default_account].concat(
|
||||
$.map(wn.report_dump.data["Account"], function(ac) {
|
||||
return (company===default_company ||
|
||||
accounts_by_company[company].indexOf(ac.name)!=-1) ?
|
||||
ac.name : null;
|
||||
})));
|
||||
}));
|
||||
var old_account = me.filter_inputs.account.val();
|
||||
|
||||
$filter.empty().add_options(new_options);
|
||||
|
||||
if((old_account != default_account) && new_options.indexOf(old_account)!=-1) {
|
||||
$filter.val(old_account);
|
||||
}
|
||||
|
||||
// chosen
|
||||
$filter.trigger("liszt:updated");
|
||||
|
||||
me.filter_inputs.refresh.click();
|
||||
});
|
||||
|
||||
this.filter_inputs.account && this.filter_inputs.account.change(function() {
|
||||
me.filter_inputs.refresh.click();
|
||||
});
|
||||
|
||||
},
|
||||
init_filter_values: function() {
|
||||
this._super();
|
||||
this.filter_inputs.company.change();
|
||||
},
|
||||
apply_filters_from_route: function() {
|
||||
this._super();
|
||||
this.filter_inputs.company.change();
|
||||
},
|
||||
make_accounts_by_company: function() {
|
||||
var accounts_by_company = {};
|
||||
var me = this;
|
||||
@ -134,7 +151,7 @@ erpnext.GeneralLedger = wn.views.GridReport.extend({
|
||||
account = this.account_by_name[account];
|
||||
item_account = this.account_by_name[item_account];
|
||||
|
||||
return (item_account.lft >= account.lft && item_account.rgt <= account.rgt)
|
||||
return ((item_account.lft >= account.lft) && (item_account.rgt <= account.rgt));
|
||||
},
|
||||
prepare_data: function() {
|
||||
// add Opening, Closing, Totals rows
|
||||
|
@ -40,10 +40,14 @@
|
||||
<li>Ace - code editor</li>
|
||||
<li>Slick Grid - report grid</li>
|
||||
<li>jQPlot - graphs</li>
|
||||
<li><a href="http://taitems.github.com/jQuery.Gantt/">JQuery.Gantt</a> - Gantt Chart</li>
|
||||
<li><a href="http://taitems.github.com/jQuery.Gantt/" target="_blank">
|
||||
JQuery.Gantt</a> - Gantt Chart</li>
|
||||
<li>JSON2 - JSON builder, parser</li>
|
||||
<li>JSColor - color picker</li>
|
||||
<li><a href="https://github.com/dcneiner/Downloadify">Downloadify</a> - Export CSV files from the browser</li>
|
||||
<li><a href="https://github.com/dcneiner/Downloadify" target="_blank">
|
||||
Downloadify</a> - Export CSV files from the browser</li>
|
||||
<li><a href="https://github.com/harvesthq/chosen" target="_blank">
|
||||
Chosen</a> - a searchable select dropdown</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user