Sigma Php Ajax framework, Ajax Components, GUI Builder
May 21, 2012, 09:32:49 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: subtotal display?  (Read 727 times)
chaze
Jr. Member
**
Posts: 9


View Profile
« on: July 07, 2009, 07:04:24 AM »

Hello!

I need to calculate the subtotal of each column and display at the 1st or last row of the grid.

do you know any convenient way to do it? I am thinking to add extra row the end. however, this mean the grid can't not sort.

any idea will be appreciated!

thanks!
Jim
Logged
steven
Moderator
Hero Member
*****
Posts: 544



View Profile
« Reply #1 on: July 07, 2009, 05:57:41 PM »

For work around, you need to do a customized sorting.
Make it clearer, for example, you could add an extra field to indicate if it's a subtotal.
When you do a customized sorting, determine if it's a subtotal by that extra field.
See
http://www.sigmawidgets.com/products/sigma_grid2/demos/example_customized_sort.html
to define a sort rule
Logged

Sigma AJAX Data Grid - Easy to Integrate with PHP, ASP Classic, ASP.NET & Java
Sigma PHP Ajax Framework - WYSIWYG GUI Builder With Tree, Grid, Treegrid, Dialog, Tab & More Component
chaze
Jr. Member
**
Posts: 9


View Profile
« Reply #2 on: July 13, 2009, 05:48:06 AM »

Hello,

I defined below function for sorting. I am able to freeze the subtotal/average row at bottom.
However, the sorting does not sort correctly.

function sort_fnt(r1,r2){
   if ( r1.ctrlflag1.replace(/^\s+|\s+$/g,"")!="1" )
      return 1;
   else {
      return -1;
   }
}

I tried return 0 on 2nd logic which make sorting not move. I dont want to do the custom sort by subtract on r1/r2 as i need to support all column sorting which means i need to have same number of sort function defined. (eg r1.columnA - r2.columnB ...)

Any help?

Jim
Logged
chaze
Jr. Member
**
Posts: 9


View Profile
« Reply #3 on: July 15, 2009, 12:15:08 AM »

Any help sir?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!