Le 9 juil. 10 à 16:25, zryip theSlug a écrit :
The correct usage of the closeFieldEditor is to use it in the
default column
behavior or the column behavior of thecolumns to sum (Débit and
Crédit)
Add a column behavior to the first column (Débit), and edit the
behavior.
In the script, change the closeFieldEditor like this:
on closeFieldEditor pFieldEditor
set the text of fld "fldTotDébit" to the uSumOfColumn["Débit"] of
the dgControl of me
set the text of fld "fldTotCrédit" to the uSumOfColumn["Crédit"] of
the dgControl of me
end closeFieldEditor
Untested but should work.
If all is ok, update the column behavior of the "crédit" column with
the
same script
I am learning a lot on behaviors in data grid thanks to you!
But I am just gettting a very strange result!
- I created a new stack
- dragged a data grid with two columns "Débit" and "Crédit"
- populated it with some lines of numbers
- In the script of the data I put grid the following handler:
getprop uSumOfColumn[pColumn]
local theTotal,theDataA,
--------------------
put 0 into theTotal
put the dgData of me into theDataA
repeat for each key theIndex in theDataA
add theDataA[theIndex][pColumn] to theTotal
end repeat
return theTotal
end uSumOfColumn
Two normal fields under each column: "fldTotDébit" and "fldTotCrédit"
- added a column behavior for column Débit
- added a column behavior for column Crédit
In the script of the two btn : btn "Débit Behavior" and btn "Crédit
Behavior" I added the handler you suggested
on closeFieldEditor pFieldEditor
set the text of fld "fldTotDébit" to the uSumOfColumn["Débit"] of
the dgControl of me
set the text of fld "fldTotCrédit" to the uSumOfColumn["Crédit"] of
the dgControl of me
end closeFieldEditor
Then,
when changing a value in one column, the total of this column is false
but I got the right total in the other one
and vice versa:
If I change a value int the second column : this time the total is
false and the total of the first column becomes right.
Really "bizarre" isn'it?
Any idea on what causes that? what am I doing wrong?
André
2010/7/9 Andre.Bisseret <[email protected]>
Bonjour TheSlug,
Thank you for your reply.
Seems I am missing something
I have 2 fields under the datagrid where I want to put the total of 2
columns of the datagrid (fldTotDébit and fldTotCrédit)
In the script of the datagrid, I put:
on closeFieldEditor pFieldEditor
set the text of fld "fldTotDébit" to the uSumOfColumn["Débit"] of me
set the text of fld "fldTotCrédit" to the uSumOfColumn["Crédit"]
of me
end closeFieldEditor
but when I edit a cell of the datagrid nothing happens
Could be because I don"t know what should be the parameter
pFieldEditor?
André
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution