Live update ...

Hi !

I leaved this question in grid section . But no any answer … :frowning: . Maybe here you will help …

The problem , that live update isn’t working adding new record from form . Update and delete actions are visible , they are related to grid and dataProcessor. Only insert action isn’t visible . Here is mine validation of form and insert of new record :

         myForm.attachEvent( "onButtonClick", function( id ) 
         {
            if ( myForm.validate() )
            {
               var 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(); // reload of mygrid
                  mygrid.load( cQry,function(){ mygrid.selectRowById( cNew ); } );
                  return true;
               }
               else
                  alert( loader.xmlDoc.responseText );
            }      
         });

As you can see , I let to php code insert new record to database and then reload grid . DataProcessor isn’t participating here … So how I can to let to know for “live update” that “insert” action is from form ? “defineAction” of “insert” status ? Any ideas and help are welcome …

With best regards !

After adding data and reloading the grid (after loading callback), call the next code

dp.callEvent("onAfterUpdate",[id, "insert", id]);

It will immitate callback of dataprocessor and will trigger all necessary actions to sync adding of new row

Woww ! :smiley:

After adding data and reloading the grid (after loading callback), call the next code
dp.callEvent(“onAfterUpdate”,[id, “insert”, id]);
it will immitate callback of dataprocessor and will trigger all necessary actions to sync adding of new row

It works ! Very fine ! Thanks to you , Stanilav ! With bes regards ! :slight_smile: