colpreupdate event

Previous Next

The colpreupdate event occurs before a value in a column is updated. You can use this event to change the new value before it is actually set.

Pass in a function and use properties of the options parameter. The following properties are exposed:

value

The value that the column is updated to

col

The column being updated

record

The indexes of the affected rows

Example 1

This example tacitly sets a new age value to 18 if the value that the user attempts to update this column to is lower than 18:

$.udb("EMP").on("colpreupdate", function(evt, options) {

  if (this.rows('current').cols("AGE").val() < 18)

    option.value = 18;

});

 

If the context of your code is such that the updated column is known to be the AGE column, you can abbreviate to:

$.udb("EMP").on("colpreupdate", function(evt, options) {

  if (options.col.val() < 18)

    option.value = 18;

});

 

Example 2

This example replaces any empty values by the value "Unknown":

$.udb("EMP").on("colpreupdate", function(evt, options) {

  if (options.value == "")

    option.value = "Unknown";

});

 

 

See Also

Data Source Events