DP onBeforeUpdate

Description here : docs.dhtmlx.com/doku.php?id=dhtm … foreupdate .

Added in mine source :


      myDp.attachEvent( "onBeforeUpdate", function( id, status, data )
      {
         if ( status == "deleted" )
            return true;
         else            
         {
            var index = data.getColIndexById( "prek_grupe" );
            var value = this.data.cells( id, this.index );
            if ( !iras_valid( value ) )
               return false;
         }
         return true;
      });

“data” - undefined . So I’m getting error . How true it must be ?

With best regards !

Hi ,

Can you give me a sample , in which I can use myDp.attachEvent( “onBeforeUpdate”, function( id, status, data ) event ? I need to check some values before uodating/insert .

With best regards !

If you are using send-all-at-once mode ( default in case of connector ) - onBeforeUpdate will not provide third parameter - it seems to be a bug and will be fixed in next version.

For now you can use

myDp.attachEvent( "onBeforeUpdate", function( id, status) { if ( status == "deleted" ) return true; else { var index = mygrid.getColIndexById( "prek_grupe" ); var value = mygrid.cells( id, index ).getValue(); if ( !iras_valid( value ) ) return false; } return true; });