Opened 10 years ago

Closed 6 years ago

#8351 closed defect (patchwelcome)

onApplyCellEdit for cells with dojox.grid.cells.Bool type is called 2 times (except the first time)

Reported by: Kenny Owned by: Bryan Forbes
Priority: high Milestone: future
Component: DojoX Grid Version: 1.2.3
Keywords: grid cell checkbox onApplyCellEdit Cc:
Blocked By: Blocking:

Description

Hello,

Check my example. I put an alert in the onApplyCellEdit function. Click on the checkbox more than 1 time to see the problem.

Kenny

Attachments (1)

1.php (2.5 KB) - added by Kenny 10 years ago.
example with the problem (just change the path to dojo)

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by Kenny

Attachment: 1.php added

example with the problem (just change the path to dojo)

comment:1 Changed 10 years ago by Kenny

I forgot to mention:

The problem appears on FF3, IE7 & GC

++ Kenny

comment:2 Changed 10 years ago by Bryan Forbes

Milestone: tbd1.3

comment:3 Changed 10 years ago by Kenny

I discovered, I think the source of the problem.

In the case of a type:dojox.grid.cells.Bool in a grid, the 'onApplyCellEdit' function is called before the 'onStartEdit' function.

And when you focus on another cell / row (or maybe the onblur of the Bool), the 'onApplyCellEdit' function is called a second time.

Hope this help

Kenny

comment:4 Changed 10 years ago by Kenny

For those who have the same problem, here is a workaround:

Instead of checking the difference between the old value and the new value in the 'onApplyCellEdit' function for the type:dojox.grid.cells.Bool, do nothing like:

var fct_OnApplyCellEdit = function (inValue, inRowIndex, inFieldIndex) {

if (inFieldIndex != "the name of your Bool field") {

do your stuff to control the value of your cell

}

}

And in 'onStartEdit' function you catch the change and do your stuff:

var fct_OnStartEdit = function (inCell, inRowIndex) {

if (inCell.field == "the name of your Bool field") {

do the stuff for your Bool type cell like an ajax request to update the data.

} else {

do the normal stuff

}

}

comment:5 Changed 10 years ago by Bryan Forbes

Milestone: 1.3future

comment:6 Changed 6 years ago by bill

DojoX Grid and EnhancedGrid are deprecated in favor of dgrid and gridx.

You should upgrade your code to use one of those two grids.

We will consider patches to the old DojoX Grid code though.

comment:7 Changed 6 years ago by bill

Resolution: patchwelcome
Status: newclosed
Note: See TracTickets for help on using tickets.