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=2and here is the full source code.
http://mate.mukeshdak.com/src/direct_edit.phps