Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to calculate percentages for each row corresponding to group total #72

Open
rrameshkumar76 opened this issue Jun 27, 2019 · 1 comment

Comments

@rrameshkumar76
Copy link

rrameshkumar76 commented Jun 27, 2019

Is there a way to calculate percentages for totals columns for each row corresponding to group total

Basically if there is a way to to get the group total or the row in calculations for the level above.

If not I guess we need to pass back the parent record to the template

@rrameshkumar76
Copy link
Author

rrameshkumar76 commented Jun 28, 2019

May could do something like

renderTableBody: function (columns, rows) {
    var self = this
    var parents = new Map()
    return (
      <tbody>
      {rows.map(function (row) {
        parents.set(row._level, row)
        return (
          <tr key={row._key} className={"reactPivot-level-" + row._level}>
            {columns.map(function (col, i) {
              if (i < row._level) return <td key={i} className='reactPivot-indent' />
              var topLevelParent = parents.get(0)
              var previousLevelParent = row._level > 0 ? parents.get(row._level - 1) : topLevelParent
              return self.renderCell(col, row, topLevelParent, previousLevelParent)
            })}
          </tr>
        )

      })}
      </tbody>
    )
  },

to calculate all the parents and pass to the renderCell and from there to template methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant