Find new added record

Hi,
Can’t understand how to find new added record in the grid . I’m adding new record from from . Source after form validation :

         myForm.attachEvent( "onButtonClick", function( id ) 
         {
            if ( myForm.validate() )
            {
               cNew  = myForm.getItemValue( 'mod_grp' ).toUpperCase();
               var cFlds = "prek_grupe,prek_tipas,pav_lt,pav_en,db";
               var cVars = "'" + cNew + "','Gaminys','" + 
               myForm.getItemValue( 'pav_lt' ) + "','" + 
               myForm.getItemValue( 'pav_en' ) + "','" + $app_db + "'";
               var loader = dhtmlxAjax.getSync( "lent_new.php?tbl=prekiu_grupes&fld=" + cFlds + "&nvr=" + cVars );
               if ( loader.xmlDoc.responseText == "true" )
               {
                  w1.close();
                  mygrid.clearAll();
                  mygrid.load( cQry );
                  surasti( cNew );
                  return true;
               }
               else
                  alert( loader.xmlDoc.responseText );
            }      
         });

For search of new record used findCell() :

      function surasti( cNew )
      {
         if ( cNew.length !== 0 )
         {
            var surast = mygrid.findCell( cNew );
            debugger;
            alert( surast );
         }
      }

Sorry , but this isn’t working . Can you help me , what to do in this situation ?

With best regards ! Rimantas

Please, try to call surasti function after the data is loaded to the grid. You may try to use onXLE event or a callback of the load() method

mygrid.load( cQry,function(){ surasti( cNew ); });

Thanks sematik ! That helped . :slight_smile:

With best regards Ą