Open GeorgeDeac opened 5 months ago
@GeorgeDeac You can achieve directly setting the query within the onload_post_render event, eliminating the need for the refresh event.
frappe.ui.form.on("doctype", {
onload_post_render: function(frm) {
frm.set_query("field", {
filters: {
"field1": 1,
"field2": 2
}
});
}
});
@GeorgeDeac You can achieve directly setting the query within the onload_post_render event, eliminating the need for the refresh event.
frappe.ui.form.on("doctype", { onload_post_render: function(frm) { frm.set_query("field", { filters: { "field1": 1, "field2": 2 } }); } });
Yes, but I need to change the filter dynamically by script interaction, depending on how other field/s are changing in real time, not just set it once at page load. The only workaround I found was using autocomplete fields and a custom script to fetch values from the server depending on the parameters taken from the other fields. Is this also possible directly with the link fields by changing the filter in real time?
frm.set_query('fieldName', 'doctype', function() {
return {
filters: { 'filterField': 'value' }
};
});
is applying filter to link field but when i use order_by,limit etc. after the filters that are not applying on link field filter. here is my code: -
frm.set_query('fieldName', 'doctype', function() {
return {
filters: { 'filterField': 'value' },
order_by='date desc',
limit = 20
};
});
Information about bug
On a client script when we try to dynamically change the filtering on a link type field, via overriding the default set_query method of the field by specifying new filter values, we can't do so dynamically. I've tried both refreshing just the field, and refreshing the entire doctype, but it doesn't work. The new filter value is however applied only after a full manual browser page refresh.
Is there any other method one could use to achieve this expected functionality?
Module
other
Version
Frappe Framework: v14.47.2 (version-14) ERPNext: v14.37.1 (version-14)
Installation method
manual install
Relevant log output / Stack trace / Full Error Message.
No response