EasyUI Forum

General Category => General Discussion => Topic started by: ahybits on October 22, 2015, 12:11:06 PM



Title: Change Total\Footer during Filter
Post by: ahybits on October 22, 2015, 12:11:06 PM
Hi,

I would like a method\suggestion on how to update the totals (either in a footer or some other place on the page) of the values shown after a filter has been used\set

Regards,
A


Title: Re: Change Total\Footer during Filter
Post by: stworthy on October 22, 2015, 08:12:13 PM
You can call 'reloadFooter' method to update the footer rows with any data.
Code:
$('#dg').datagrid({
showFooter:true,
onLoadSuccess: function(data){
$(this).datagrid('reloadFooter', [
{name: 'name1', salary: 60000}
]);
}
});


Title: Re: Change Total\Footer during Filter
Post by: ahybits on October 23, 2015, 11:08:14 AM
Thanks, but interesting, IF I have both showFooter and enableFilter, I only see the filter not the footer (having jsut showFooter to true, i see the footer)

Also, just for a clarification, if I use the filter, will the parameter of 'data' within onLoadSucecss only show the values filtered?


Title: Re: Change Total\Footer during Filter
Post by: ahybits on October 26, 2015, 01:10:05 PM
Any ideas / confirmation on that data?

When i attempt that, i always get all data, not the filtered data


Title: Re: Change Total\Footer during Filter
Post by: stworthy on October 26, 2015, 07:21:24 PM
The 'onLoadSuccess' event fires when data is loaded successfully. When you filter the datagrid, only the filtered data is loaded. Please refer to this example http://jsfiddle.net/4L0qjbys/


Title: Re: Change Total\Footer during Filter
Post by: ahybits on October 28, 2015, 03:08:38 PM
Awesome, got it working with your help; thanks