Page 1 of 1

Edit on double-click in table row?

PostPosted: Tue Sep 10, 2013 9:52 am
by medias
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?

Re: Edit on double-click in table row?

PostPosted: Tue Sep 10, 2013 2:48 pm
by medias
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;
}

Re: Edit on double-click in table row?

PostPosted: Fri May 04, 2018 10:08 pm
by thehrushi
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?

Re: Edit on double-click in table row?

PostPosted: Tue Apr 30, 2019 8:35 am
by Sundance
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.'\');';