Edit on double-click in table row?

Discuss MySQL Ajax Table Editor Pro Version

Edit on double-click in table row?

Postby medias » Tue Sep 10, 2013 9:52 am

In the paid Version it was possible to disable the buttons (especially the edit-button), but allowing to open the edit form on double-click in the table row. Is this possible in the pro Version?
medias
 
Posts: 8
Joined: Mon Mar 05, 2012 6:29 pm

Re: Edit on double-click in table row?

Postby medias » Tue Sep 10, 2013 2:48 pm

I found a solution on my own. :lol:
Might be helpful to some of you.

Code: Select all
function initiateEditor()
{
    ...
    // Modify row set: edit on dblClick
    $this->Editor->setConfig('modifyRowSets',array(&$this,'rowsetEditOnDblClick'));
}

function rowsetEditOnDblClick($rowSet,$rowInfo,$rowNum) {
    $rowSet['onDblClick'] = $this->mateInstances[0].".editRow('".$rowInfo['id']."');";
    return $rowSet;
}
medias
 
Posts: 8
Joined: Mon Mar 05, 2012 6:29 pm

Re: Edit on double-click in table row?

Postby thehrushi » Fri May 04, 2018 10:08 pm

This worked for me. But this takes me to the full edit screen. I tried using editInPlace function but it requires the current row number to work. I tried adding that in as well, but MATE gives error on double click: "mate_row_ not found". Any way this can be made to work with inline editing?
thehrushi
 
Posts: 7
Joined: Fri May 04, 2018 10:06 pm

Re: Edit on double-click in table row?

Postby Sundance » Tue Apr 30, 2019 8:35 am

I did the editInPlace on double click by adding in AjaxTableEditor.php the proper event. That is add the line starting with $rowSets['ondblclick'] after $rowSets['onclick'] line in function "public function getRowHtml($row,$numRows)".

Code: Select all
public function getRowHtml($row,$numRows)
{
   $rowInfo = array();
   $rowSets = array();
   $rowSets['id'] = $this->instanceName.'row_'.$numRows;
   //$rowSets['class'] = 'ajaxRow';
   //$bgColor = ($numRows % 2) == 0 ? $this->evenRowColor : $this->oddRowColor;
   //$rowSets['bgcolor'] = $bgColor;
   $rowSets['class'] = ($numRows % 2) == 0 ? 'even' : 'odd';
   $cbInfo = $this->getCbInfo($row,$numRows);
   $html = $cbInfo['cb_html'];
   if($cbInfo['has_active_cb']) {
      $rowSets['onclick'] = $this->instanceName.'.rowClicked(\''.$numRows.'\');';
      $rowSets['ondblclick'] = $this->instanceName.'.editInPlace(\''.$row[$this->primaryKeyCol].'\',\''.$numRows.'\');';
Sundance
 
Posts: 5
Joined: Wed Jan 29, 2014 12:14 pm


Return to Pro Version

Who is online

Users browsing this forum: No registered users and 1 guest