Appframe Knowledge Base


1 hits
0

Setting default values when moving to a new record in data object

/* To set default values when focusing "new row",
   attach an event to the data object's onCurrentIndexChanged event
   and set the default values using this.currentRow(pFieldName, pValue); */

dsDataObject.attachEvent("onCurrentIndexChanged", function(pIndex) {
    if(pIndex === -1) { // index is -1 when "new row" is active
        // "this" is a reference to the data object inside this scope
        this.currentRow("FieldName", "My Default Value");
    }
});

components dataobject web · Perma link post comment Posted by: Jan Henrik H. Meling (14-mai-2012)