[TREEGRID] coro[=sum] column can't be edited

In a treegrid with smartXMLparsing disables, I have a row with severals subrows.

One column of this treegrid is set as a “coro[=sum]”.

The combo box is filled with this script :

    var combo = mygrid.getCombo(1);




the treegrid init is done by loading an XML with contains values formatted like that for each row:



Everything seems to works fine, until you try to edit this column : No edit event seems to be launched (other columns works).

If you set this column to “coro”, editing works fine but, of course, sum of subrows doesn’t work anymore.

Any thought ?

The cell in grid can be
a) normal editable cell
b) cell, which value calculated by math

It not possible to combine both functionalities for the same cell, because cell can’t allow direct input and show result according assigned math formula in same time.

In described situation you can define whole column as math, and mark cells, which is “coro” directly in XML


<cell type=“coro”>0.50

Please check attached sample, the third column in it also defined as =sum but last level elements described in XML as editable - as result the sum functionality works for folders, and leaf items editable in the same time.

1212483120.ZIP (10.8 KB)

Thanks for your quick input.
Setting each cell as “coro” corrects my issue.

However, I still have a last issue.
When adding or deleting a subrow (script command driven by a context-menu), row sum doesn’t refresh accordingly.
For now, refresh seems to be only called on edit of a cell of a subrow.
Any way to force sum update  ?

Migrating from 1.5 to 1.6 is not such a easy operation, aftter all :wink:

The =sum calculation works fine for newly added rows in local tests, but if you are using both in-line and sum math formulas the problem really may occur.
Please try to use attached js file instead of original one - it must correctly process math formulas in newly added rows ( the online package will be updated with the same fix in nearest time )

>>Any way to force sum update  ?
There is no special API for such case, but if you need to force the “=sum” formulas, you can use
beware that it will trigger any custom onXLS code as well.

dhtmlxgrid_math_fix.zip (36.9 KB)

Please try to use attached js file instead of original one
Tried. Doesn’t fix the problem.
After a brief look at ‘ext/dhtmlxgrid_math.js’, I notice this part in the ‘constructor’ :


        if (this._mat_links[id]){
            var cell=this._mat_links[id][ind]
            if (cell){
        if (!this._parsing && this._aggregators[ind]){
            var pid=this._h2.get[id].parent.id;
            if (pid!=0){
                var ed=this.cells(pid,ind);
        for (var i=0; i < this._aggregators.length; i++) {
            if (this._aggregators[i])
                    if (el.childs.length!=0){
                        var ed=this.cells(el.id,i);

Sorry if it’s not relevant but it maybe come from here as only loading,unloading and editcell events are covered ?

 >> grid.callEvent(“onXLS”,[]);
>> beware that it will trigger any custom onXLS code as well.
I will try this workaround if no other solution arises as I have to rewrite a good piece of my code to bypass functions called at XLS event.

Just try for debug to put this code after adding/deleting a row :
It actually forces the refresh which seems to validate my previous assertion.

For information,
doesn’t seem to update sum.

The math done through onCellChanged event - this event triggered for ALL operation which change cell values ( any API call which change cell value will trigger it, not only edit operations)
When row created - this event will fire for each cell in row, and if any of it contains the math - it will trigger calculations ( the updated js file attached to previous post resolves issue with row registration, so on moment of data filling it is available to API calls )

With latest version of js file - the math works correctly against for newly added rows ( both per column sum and per row operations ) - I can send a sample if necessary.
Can it be that some custom excell type used in your case?

doesn’t seem to update sum.
This was a typo from our side, sorry for inconvenience

As it seems that my issue is probably due to a bad mix of several features mixed together, I’ve tried to produce a minimalist sample (stripped down from my application).
You’ll find in attachment a standalone sample that demonstrate my issue.

Please note thoses commented line :
line 317 : mygrid.cellById(timestamp,1).setValue(“1.00”); //HACK HAVE TO RESET VALUE AS ADDROW DOESN’T WORK PROPERLY
line 327 : mygrid.callEvent(“onXLE”,[]);  // HACK FORCE SUM REFRESH
line 334 : mygrid.callEvent(“onXLE”,[]); // HACK FORCE SUM REFRESH

For now, I have to seperate issue in this sample :
1- AddRow method doesnt’ work properly as It doesn’t set value for column 1
2- Sum is not updated when adding Row ou deleting Row.

P.S. : Sample attachment could be removed as soon as you took it.

There was a tricky bug related to usage of coro_excell as math based in treegrid
Fixed files sent by email.

Fixes tested.
It Corrects issues but seems to create a new one.

It might be in the chain of events, as some are triggered with delay.
When I delete or add a row, I put in my custom code a refresh global sum function
Sample code :

switch(menuitemId) {
            case “addRow”:
                // CODE FOR ADDING SUB ROW …//

                calculateFooterValues(); // Update footer Values (sum of rows)

            case “removeRow” :
                // CODE FOR DELETING SUB ROW …//

                calculateFooterValues(); //Update footer Values (sum of rows)

Thing is that when I add a row, ‘calculateFooterValues’ is called AFTER update of the row (that is to say Math calculation of the sum of all subrows), although when I delete a row, ‘calculateFooterValues’ is called BEFORE  update of the row and thus doesn’t update of correct value.

According to me,the most elegant way of correcting this issue would be to use a event called when all maths calculations are done. However, after scooping your code quickly, no event of this kind seems to exist.
Any idea ?

Yes, the problem caused by the way how math recalculated after row deleting, while all other math recalculated in sync mode - this part done in async. way, which cause problems with custom code.
The code adjusted to work correctly. Fixed files sent by email.

Just found out Aggregation in TreeGrid feature.
That’s perfect for my needs. I just replace my calculateFooterValues() function by {#stat_tree_total_leaf} in the attached footer.
Unfortunatly, adding a row produces now a error :
row has no properties
(breakpoint : if (row._locator){
enet-dev/LIB/JAVASCRIPT/DHTMLX/d … mlxgrid.js
Line 5312 )

Fixed “stat and filter in treegrid” extension attached

dhtmlxtreegrid_filter.zip (2.14 KB)

Tried out fixed “stat and filter in treegrid” extension which corrects my previous error.

However, for the sake of getting last fix for each issue, I didn’t received by email fixed code for async delete issue.

Furthermore, I just noticed (It might be linked) that if I create several subrows and  delete one, everything seems ok. (dataprocessor installed with autoUpdate off)
When I send data (mydataprocessor.sendData() ), the deleted subrow remains in treegrid (text style no more in bold but still with a strike line).
A full reload of the page confirms that this row still exists in database.
A detailed inquiry of the ajax action shows that sometimes url sent is not what you could expect :
gridUpdate.php?gr_id=1212760077757&gr_pid=day%7C2008-06-04&c0=2008-06-04&c1=1.00&c2=day&c3=1&c4=3&c5=5&c6=13&!nativeeditor_status=inserted // CORRECT (new subrow as id could confirm)
gridUpdate.php?gr_id=778&gr_pid=day%7C2008-06-04&c0=2008-06-04&c1=0.25&c2=day&c3=1&c4=3&c5=5&c6=13&!nativeeditor_status=inserted // INCORRECT should be 'deleted’

Sorry for all thoses issues adressed in such a short time :wink:

Possible solution send by email.

I just realized that I might have mispelled my email.
Take note that  first part is ‘ndarques’ and not ‘n.darques’.
Sorry for that.

We have send all fixed files to correct email address.

Last fix tested. It corrects every last flaws.
Thanks for you extra support which, as ever, rocks !