Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Complex Table Structure using NatTable(Complex Table Structure using NatTable)
Complex Table Structure using NatTable [message #993945] Wed, 26 December 2012 01:07 Go to next message
Prashant p is currently offline Prashant pFriend
Messages: 57
Registered: October 2012
I have a table with multiple rows which will be dynamic. In between these rows i will have summary row to count Sub Total Amount and Final row will be Summary row to populate Total Amount. Each row will contain Amount of particular Item.
For example
Category1 -Item1 -100 USD,
-Item2 -200 USD.
Subtoatal to Category 1 - 300 USD.

Category2 -Item1 -300 USD,
-Item2 -100 USD.
Subtoatal to Category 1 - 400 USD.
Now total Amount row will add subtotal amount of each category i.e 700 USD.

Is there any option to achieve this using Nat Table. Basically i am trying to replicate Webpage Table to SWT/Jface . And i apologize i don get option to attach screenshot. Also please note that values in table will be populated from Database

[Updated on: Wed, 26 December 2012 02:01]

Report message to a moderator

Re: Complex Table Structure using NatTable [message #994907 is a reply to message #993945] Fri, 28 December 2012 15:59 Go to previous message
Edwin Park is currently offline Edwin ParkFriend
Messages: 124
Registered: July 2009
Senior Member
Hi Prashant,

This is certainly achievable. You have some underlying data which is grouped, and for each group you want to add a summary row. I'd probably approach this by creating an IDataProvider that returns the group data and also adds the calculated summary row:

class MyDataProvider implements IDataProvider {
  public Object getDataValue(int columnIndex, int rowIndex) {
    // figure out what group you're in based on the row index, then return the appropriate data or summary data

  public int getRowCount() {
    return underlyingDataRowCount
      + numGroups  // for each group summary row
      + 1;  // for the overall total row

If you want to change the styling for the summary rows, you'll want to also set a config label accumulator on the DataLayer that returns a different config label for summary rows. See for more info on styling.

Previous Topic:Getting Data from the DB to the NatTable?
Next Topic:How to bind single and double clicks on one cell
Goto Forum:

Current Time: Tue Mar 05 05:12:12 GMT 2024

Powered by FUDForum. Page generated in 0.02636 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top