PDA

View Full Version : Summary with empty fields doesn't count result



biohazardo
14 Feb 2012, 5:21 AM
In my table i have empty fields, where they are null. But summary doesn't count them.

31694
Left - There are empty field and no summary. Right - no empty field, there is summary.

Maybe I need to create function, that will count valid sum? But in ExtJS4 Examples is that function:


getSumSummary: function(records){
var i = 0,
length = records.length,
total = 0,
record;


for (; i < length; ++i) {
record = records[i];
total += record.get('estimate') * record.get('rate');
}
return total;
}


Where I can take that "records". What type does it have, and from where I can take it out?:-/ :s :-?

mitchellsimoens
14 Feb 2012, 5:37 AM
If you are using the Summary feature then you can override the generateSummaryData method to calculate your data. Optionally you can use the getSummary method as that is called for each column.

biohazardo
14 Feb 2012, 11:18 PM
If you are using the Summary feature then you can override the generateSummaryData method to calculate your data. Optionally you can use the getSummary method as that is called for each column.

All columns was created by return func, and I added new summary function there. And I want one more feature...
By default summary row is on the bottom of table. And user need to scroll down to see result. But how can I do fixed position summary row, at the bottom of grid box??

I think it is need to be in dockedItems of grid? But how can I push row there??

mitchellsimoens
15 Feb 2012, 4:36 AM
For that you are going to have to do more. You can use the addDocked method on the grid.

biohazardo
15 Feb 2012, 4:40 AM
For that you are going to have to do more. You can use the addDocked method on the grid.
I did it, but row need special tpl to be shown or something. I don't know, what container to user, and how to show the data...

mitchellsimoens
15 Feb 2012, 4:42 AM
I would use a simple Component.

Other things you may have to deal with is horizontal scroll and when the store reloads checking to see if there is already a toolbar docked.

biohazardo
15 Feb 2012, 4:45 AM
I would use a simple Component.

Other things you may have to deal with is horizontal scroll and when the store reloads checking to see if there is already a toolbar docked.

And does have Summary feature any events like count or something? E.X.

summary.on({
aftercount:function(){
TAKE ALL AND DO SMTHNG;
}
});