Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by soms on Jun 27, 2009 12:04
open dhtmlx forum
Mathematical Calculation and Radio Button Click

Hi,

I have two queries

My first query is,

1. One of our requirement is that ...suppose we have 5 rows .... and the first column of the first row is the sum of 2nd,3rd,4th and 5th rows first columns ...
Ex:
1 2 3
1 1000
2 100
3 400
4 300
5 200

do we have any simpler dhtmlx way of resolving this or do I manually have to do grid.cells(1,0).setValue(sum of all other row's 1st coulmn) ?

My second query is,

2. How do I know when a radio button is clicked in a cell? ....Which event does it fire? As soon as a radio button in column 3 is clicked I have to add all the values in Column 2. How do I achieve this?... Which event do i code in?

Can you please mail the reply to soumysandeep@gmail.com along with the ID soumya.sandeep@3i-infotech.com. It would be of great help.

Many Thanks in advance
soms





Answer posted by dhxSupport on Jun 29, 2009 01:00
1. You can insert following formula in the first row cells:
<cell>=[[2,0]]+[[3,0]]+[[4,0]]+[[5,0]]</cell>
<cell>=[[2,1]]+[[3,1]]+[[4,1]]+[[5,1]]</cell>
<cell>=[[2,2]]+[[3,2]]+[[4,2]]+[[5,2]]</cell>

Column types in those cells should be defined with Math formula or as type “math”.

2. You can catch radio button click using "onClick" event. onCheck event passes the following parameters: 
rId - id or the row;
cInd - index of the cell;
state- state of the checkbox/radiobutton.
grid.attachEvent("onCheck", function(rId,cInd,state){});