Go Back   SmartClient Forums > Technical Q&A
Wiki Register Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 8th Jun 2007, 08:37
senordhuff
Guest
 
Posts: n/a
Default 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?
Reply With Quote
  #2  
Old 8th Jun 2007, 10:04
Isomorphic Isomorphic is offline
Administrator
 
Join Date: May 2006
Posts: 30,524
Default

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);
},
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search


© 2010,2011 Isomorphic Software. All Rights Reserved