jQWidgets Forums
jQuery UI Widgets › Forums › Grid › How to set a new value to a other cell within cellvaluechanged event .
Tagged: cellvaluechanged, grid
This topic contains 5 replies, has 2 voices, and was last updated by Mahesh 3 years, 1 month ago.
-
Author
-
February 8, 2022 at 8:59 pm How to set a new value to a other cell within cellvaluechanged event . #121481
Hello,
How to set a new value to a other cell within the cellvaluechanged event without triggering it again.
I tried both the options (setcellvalue and setcellvaluebyid)
Following line changes a other cell’s value but cellvaluechanged event is triggered once more when a cell’s value is changed.
$(“#jqxGrid”).jqxGrid(‘setcellvalue’, 0, “firstname”, “New Value”);Following line doesn’t change a other cell’s value so don’t know the cellvaluechanged event will be triggered or not when a cell’s value is changed.
$(“#jqxGrid”).jqxGrid(‘setcellvaluebyid’, id1, “firstname”, “New Value”);Regards,
Mahesh
February 10, 2022 at 5:34 pm How to set a new value to a other cell within cellvaluechanged event . #121498Hello Mahesh,
You can use a flag to check whether the change is triggered by the
cellvaluechanged
event or not.
Here is an Example.Best Regards,
Martin YotovjQWidgets team
https://www.jqwidgets.comFebruary 13, 2022 at 7:33 am How to set a new value to a other cell within cellvaluechanged event . #121511Hello Martin,
I went through your example.
Apparently it seems to be working, but I could not understand the logic.
Please explain it in a very simple way.Regards,
Mahesh
February 14, 2022 at 12:09 pm How to set a new value to a other cell within cellvaluechanged event . #121517Hello Martin,
I also want to know whether setcellvalue method triggeres cellvaluechanged event or cellendedit event.
Regards,
Mahesh.
February 14, 2022 at 1:03 pm How to set a new value to a other cell within cellvaluechanged event . #121518Hello Mahesh,
Before we start updating the cells we initialize a boolean variable
changeTriggeredFromEvent
with value “false”.
Then when we call thesetcellvalue
method and thecellvaluechanged
event is triggered we setchangeTriggeredFromEvent
to true before updating another cell. So the next time thatcellvaluechanged
is triggered thechangeTriggeredFromEvent
variable is “true” and we know that this change comes from the event handler so we just set it to “false” again and exit the function without doing another cell update.setcellvalue
triggers only thecellvaluechanged
event.Best Regards,
Martin YotovjQWidgets team
https://www.jqwidgets.comFebruary 14, 2022 at 6:28 pm How to set a new value to a other cell within cellvaluechanged event . #121525Thanks Martin for the nice explanation.
Regards,
Mahesh -
AuthorPosts
You must be logged in to reply to this topic.