PDA

View Full Version : calculated fields in datagrid/dataholder


vwoohu
04-30-2004, 10:42 AM
Hi all,

Is it possible to have calculated fields inside the datagrid component that depends on two other fields in the dataholder component?
e.g. datagrid columns A,B,C where A = user input, B = A * b1 (b1 from dataholder) and
C = A * c1 (c1 from dataholder) ? and Dataholder has (A, b1, c1)...

I think a better solution would be to have the fields (A,B,C, b1,c1) inside the Dataholder component and only display (A,B,C) on the datagrid. Any suggestions or different approach is appreciated

Vincent

annexion
04-30-2004, 11:51 AM
Can you explain why you are using a dataHolder instead of a dataSet for the dataGrid?

To calculate fields in the dataSet you must first set the "kind" of the field you want to calculated in the schema tab of the component inspector.


calcObj={};
calcObj.calcFields = function(evt) {
evt.target.resultField = (evt.target.field1*evt.target.field2*randomOperand );
};
ds.addEventListener("calcFields", calcObj);

That should give you a jumpstart on where you're going.