Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Allan Hansen on Feb 24, 2009 06:57
open dhtmlx forum
Math and AddRow

Hi there

We set the colTypes with the following:
mygrid.setColTypes('co,dhxCalendarA,edn,ro,ed,ed,ed,edn,edn,ron[=c8-c7]');

And add new rows like this:
    var newUID = this.getUID();
    
    mygrid.addRow(newUID,'',-1);
            
    mygrid.cells(newUID,0).setValue(mygrid.cellById(this.getRowId(this.getRowsNum()-2),0).getValue());
    mygrid.cells(newUID,1).setValue(thisDay());
    mygrid.selectCell(newUID,0);

But rows added after the page has loaded the first time, don't recalculate if edited. If we add a new row it calculates correctly, but when we edit the line afterwards, it doesn't recalculate the result - how come?
Answer posted by Support on Feb 24, 2009 09:52
Incorrect ID is most possible reason of the problem.
Please be sure that   this.getUID(); returns really unique IDs ( it it based on timestamp - it may return not unique values, because js Date object is not so precise )

Answer posted by Allan Hansen on Feb 25, 2009 00:20

I've tried inserting a couple of lines and logging the ID's, and got the following:

1235549619762
1235549619763
1235549619764
1235549619765
1235549619766

So they are pretty much unique.

It seems the problem with recalculating the result only appears after the row has been written to the database. If the row hasn't been written, it recalculates fine.

Answer posted by Support on Feb 25, 2009 02:44
Problem confirmed.
After inserting row in DB, ID of record changed to one provided by DB, in same time math operations still relay on old ID

Updated version of dhtmlxgrid, where issue fixed, will be sent by email.
Answer posted by Allan Hansen on Feb 25, 2009 03:18
Thank you very much.
Answer posted by Allan Hansen on Feb 25, 2009 04:31

Hello again

I've recieved the file now, but it didn't solve the problem. It still doesn't recalculate the result.

And also, in line 1948 there is a call to debugger, which makes FireBug for FireFox act up.

Answer posted by Support on Feb 25, 2009 05:26
>>And also, in line 1948 there is a call to debugger, which makes FireBug for FireFox act up.
Sorry for inconvenience, correct js file resent. 

>>but it didn't solve the problem
Which version of dhtmlxgrid you are using?. Fix must work for dhtmlxgrid 1.6+
Answer posted by Allan Hansen on Feb 25, 2009 05:31
The readme file states: dhtmlxGrid v.2.0 Professional edition build 81009/81107
Answer posted by Support on Feb 25, 2009 08:10
Updated dhtmlxgrid_math.js sent by email as well, please try to update it in addition to updated dhtmlxgrid.js 
Answer posted by Allan Hansen on Feb 25, 2009 23:25
Thank you guys. That helped.
Answer posted by Allan Hansen on Feb 26, 2009 00:20
Just thought I would let you know that it seems like the footer has the same problem.
Answer posted by Support on Feb 26, 2009 01:29
Do you mean stat-counters in footer? Stat counters functionality not related to rows, so it must not be affected by changes of IDs or similar issues.
If data in counter not updated after such operation - you may try to add next call
        grid.callEvent("onGridReconstructed",[]);