Please an example of directly going to edit page (in Pro)

Discuss MySQL Ajax Table Editor Pro Version

Please an example of directly going to edit page (in Pro)

Postby tyrionLannister » Thu Mar 16, 2017 9:44 pm

I've had code working for years in free version that uses GET variable to go directly to edit a record
if(isset($_GET['coid']))
{
echo "var ajaxUrl = '".$_SERVER['PHP_SELF']."?coid=".$_GET['coid']."';";
echo 'toAjaxTableEditor("edit_row","'.$_GET['coid'].'");';
}


I've been searching the forums but can't find an example of how to do this in the new pro version.
tyrionLannister
 
Posts: 1
Joined: Thu Mar 16, 2017 9:27 pm

Re: Please an example of directly going to edit page (in Pro

Postby mukeshdak » Sun Mar 11, 2018 12:18 pm

To do so javascript code need to be changed in function displayHtml() as follows. instead of

Code: Select all
      $javascript = '   
         <script type="text/javascript">
            var ' . $this->mateInstances[0] . ' = new mate("' . $this->mateInstances[0] . '");
            ' . $this->mateInstances[0] . '.setAjaxInfo({url: "' . $_SERVER['PHP_SELF'] . '", history: true});
            ' . $this->mateInstances[0] . '.init("' . $defaultSessionData . '");
         </script>';
      echo $javascript;


use following code
Code: Select all
      if(isset($_GET['id']))
      {
         $javascript = '<script type="text/javascript">
            var ' . $this->mateInstances[0] . ' = new mate("' . $this->mateInstances[0] . '");               
               ' . $this->mateInstances[0] . '.init("' . $defaultSessionData . '");
               ' . $this->mateInstances[0] . '.toAjaxTableEditor("edit_row", ' . $_GET["id"] . ');               
         </script>';
      }
      else
      {
         $javascript = '   
         <script type="text/javascript">
            var ' . $this->mateInstances[0] . ' = new mate("' . $this->mateInstances[0] . '");
            ' . $this->mateInstances[0] . '.setAjaxInfo({url: "' . $_SERVER['PHP_SELF'] . '", history: true});
            ' . $this->mateInstances[0] . '.init("' . $defaultSessionData . '");
         </script>';
      }
      
      echo $javascript;


following is the online demo link for your reference.
http://mate.mukeshdak.com/direct_edit.php?id=2

and here is the full source code.
http://mate.mukeshdak.com/src/direct_edit.phps
mukeshdak
 
Posts: 30
Joined: Fri May 11, 2012 3:18 pm


Return to Pro Version

Who is online

Users browsing this forum: No registered users and 1 guest

cron