Welcome Guest Search | Active Topics | Sign In | Register

Total column in Grid Options
James
Posted: Monday, January 4, 2010 2:03:40 PM
Rank: Member
Groups: Member

Joined: 10/4/2008
Posts: 28
Is there an example showing a column which is calculated from 2 other columns in the grid? Such as count * price = total?

Thanks,
James
eo_support
Posted: Monday, January 4, 2010 2:25:51 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We don't have a sample that demonstrates that. You will need to handle the Grid's ClientSideCellSelected event and then update the cells accordingly. Here is a sample for handling ClientSideCellSelected event:

http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\_i11

Inside the event handler you can do something like this:

Code: JavaScript
//Get the grid object
var grid = eo_GetObject("Grid1");

//Get the first row
var row = grid.getItem(0);

//Get the total of the first cell and the second cell
var total = row.getCell(0).getValue() + row.getCell(1).getValue();

//Add them together and assign to the third cell
row.getCell(2).setValue(total);


If you have a lot of data, you can also handle ClientSideAfterEdit event:

http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\_i23

That way your handler is only called after a cell has changed.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.