Instead of using onclick, try create a dynamic action
Selection Type: jQuery selector
jQuery selector: :checkbox
Condition: is not null
You can now have true and false actions, based on if it's checked.
You can use that same object to traverse the row around the checkbox, if you want to get/set values.
You could also use link attributes to embed data to make it more accessible from the JS using data- attributes.
With all that said, I suggest to move your calculation server-side. For persisting selected values you can use for example this method Re: Interactive Report Check box looses check on record page navigation and once you're on the server and you also know what records are (de)selected, you can also simply perform your calculation there. Let's say you have an item PX_CALCULATION_RESULT, so just assign it a value in your PL/SQL DA and specify it as an Item to Return.
thanks swesley_perth for your comment.
I have a question,
how can I pass the value of my checkbox to jQuery selector: :checkbox, my checkbox exists in IR and I used this query to define it on the report(apex_item.checkbox(1,a.rowid,'UNCHECKED') flag).
I think if I can get the value of my checkbox which is the rowid then I can make my calculation in the DA
I tried before to get the value of my checkbox using APEX_APPLICATION.G_F01.COUNT in dynamic action but it didn't work .
and using the dynamic action I couldn't find away to do this, it will be so easier if i can get the value of my checkbox using dynamic action !
But you can quite easily get it's value. Please, read the documentation to apex_item.checkbox2 APEX_ITEM function (there is a p_value parameter), follow the example on the link above (Interactive report...) and eventually ask questions.
Also you cannot go wrong with creating an example here https://apex.oracle.com/pls/apex/f?p=4550:1:111542093469146::::: , share developer credentials to your workspace and your problem will be very likely solved in a short time.