Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Dynamically suspending validation on a ListGrid record

    Hi,

    We have a ListGrid where the user can mark a record for deletion but it doesn't get deleted until they click Save. I'd like to suspend all validation checks on the record that has been marked for deletion. If the user chooses to "un-mark" the record for deletion, then the validation would then be dynamically applied again. Is this possible?

    #2
    You can do this by overriding 'validateRow()' (called to validate an entire row when the user moves to a new row by default) and 'validateCell()' (called to validate a single cell when the user moves to a new cell if validating by cell).
    Have these methods return "true" for records marked for deletion (meaning they pass validation without actually running any validators).
    You will need to invoke the default implementation by calling "Super" for rows you want to validate normally.

    So your chunk of code might look like this:

    Code:
    validateCell:function (rowNum, fieldName) {
        var record = this.getRecord(rowNum);
        if (record && record._deleted) return true;
        return this.Super("validateCell", arguments);
    },
    validateRow : function (rowNum) {
        var record = this.getRecord(rowNum);
        if (record && record._deleted) return true;
        return this.Super("validateRow", arguments);
    },

    Comment

    Working...
    X