addInPlace under Table Titles

Discuss MySQL Ajax Table Editor Paid Version

addInPlace under Table Titles

Postby galoagui » Wed Oct 07, 2015 10:58 am

Hi,

When we have a lot of rows we don't see the fields' names.
I would like to have the add line under header. is it possible?

Thanks
galoagui
 
Posts: 24
Joined: Fri Apr 13, 2012 11:20 am

Re: addInPlace under Table Titles

Postby KarelB » Wed Oct 07, 2015 6:57 pm

I don't think it is a configurable option.
But it should be really easy to override the class and change the layout of the table.

Also, I don't know your application but you can limit the number of rows that are displayed. I normally limit it to 20 rows as this still fits on my laptop. This still shows me all MATE's functionality in one view.

Regards
Karel
KarelB
 
Posts: 458
Joined: Mon Dec 01, 2008 11:49 pm
Location: The Netherlands

Re: addInPlace under Table Titles

Postby galoagui » Thu Oct 08, 2015 6:32 am

Hi again,

I'm trying to modify the class AjaxTableEditor, function DisplayTableHtml, but i dont get it. :-(
Could you tell me, if it's this function?

Thank you so much.
galoagui
 
Posts: 24
Joined: Fri Apr 13, 2012 11:20 am

Re: addInPlace under Table Titles

Postby KarelB » Thu Oct 08, 2015 10:28 am

That is the correct function.
Move the logic of the InplaceEdit t o the top and see if it works for you
KarelB
 
Posts: 458
Joined: Mon Dec 01, 2008 11:49 pm
Location: The Netherlands

Re: addInPlace under Table Titles

Postby galoagui » Thu Oct 08, 2015 12:25 pm

Sorry but i dont see the logic of the InplaceEdit in function displayTableHtml

i cant find that code!
galoagui
 
Posts: 24
Joined: Fri Apr 13, 2012 11:20 am

Re: addInPlace under Table Titles

Postby hexxamillion » Thu Oct 08, 2015 10:00 pm

I was wondering about this same thing. Even with 20 records it still makes more sense to have the new record line at the top.
hexxamillion
 
Posts: 100
Joined: Fri Jul 08, 2011 11:36 pm

Re: addInPlace under Table Titles

Postby galoagui » Fri Oct 09, 2015 12:53 pm

finally, i've duplicated the header but in bottom position
So, i see the fields when i use addInPlace
Attachments
Captura.JPG
Captura.JPG (25.66 KiB) Viewed 34707 times
galoagui
 
Posts: 24
Joined: Fri Apr 13, 2012 11:20 am

Re: addInPlace under Table Titles

Postby hexxamillion » Fri Oct 09, 2015 1:54 pm

galoagui wrote:finally, i've duplicated the header but in bottom position
So, i see the fields when i use addInPlace


Can you share your code? I am interested to see how you did this. Thanks!
hexxamillion
 
Posts: 100
Joined: Fri Jul 08, 2011 11:36 pm

Re: addInPlace under Table Titles

Postby galoagui » Fri Oct 16, 2015 7:37 am

Sure!

I've modified the function displayTableHtml In php/AjaxTableEditor.php.

The new code is between##


Code: Select all
function displayTableHtml()
   {
      $html = '';
      $numRows = 0;
      $this->extraOrderByInfo = empty($this->extraOrderByInfo) ? '' : ', '.$this->extraOrderByInfo;
      // Added tick marks using implod/explode in case custom order by columns have periods in them.
      $query = $this->selectClause.' '.$this->joinClause.' '.$this->whereClause.' '.$this->groupByClause.' '.$this->havingClause.' order by '.$this->orderByColumn.' '.$this->getAscOrDesc().' '.$this->extraOrderByInfo.' limit '.$this->start.', '.$this->displayNum;
      if($this->viewQuery)
      {
         $this->information[] = '<div id="'.$this->instanceName.'mateViewQuery" align="left">'.nl2br($query).'</div>';
      }
      $result = $this->doQuery($query);
      $mysqlNumRows = mysql_num_rows($result);
      $html .= '<div>';
      $html .= '<form id="'.$this->instanceName.'table_form" style="margin: 0px;" onsubmit="return false;">';
      $html .= '<table '.$this->tableInfo.'>';
      if($mysqlNumRows > 0 || stristr($this->permissions,'F') || $this->addInPlace)
      {
         $html .= '<tr id="'.$this->instanceName.'header_row" class="header">';
         if(stristr($this->permissions,'M'))
         {
            $html .= '<td id="'.$this->instanceName.'select_all_cb_cell" width="40" align="left"><input type="checkbox" id="'.$this->instanceName.'select_all_cb" onclick="'.$this->instanceName.'.selectCbs(this);" /></td>';
         }
         
         if(stristr($this->permissions,'I') && $this->iconColPosition == 'first')
         {
            $html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td>&nbsp;</td>';
         }
         
         foreach($this->tableColumns as $col => $info)
         {
            if(stristr($info['perms'],'T') && !$this->columnIsHidden($info))
            {
               $orderCol = isset($info['order_mask']) ? $this->stripTickMarks($info['order_mask']) : $col;
               $colHeaderInfo = isset($info['col_header_info']) ? $info['col_header_info'] : '';
               if(stristr($this->permissions,'F') && stristr($info['perms'],'F'))
               {
                  $filterStr = isset($this->filterSearches[$col]) ? $this->filterSearches[$col] : '';
                  $filterData = $this->jsonEncode(array($col,$filterStr));
                  //var_dump($filterData);
                  //$colHeaderInfo .= ' headers="'.$filterData.'"';
                  $colHeaderInfo .= ' filterCol="'.$col.'" filterStr="'.htmlspecialchars($filterStr).'"';
               }
               if($this->stripTickMarks($this->orderByColumn) == $orderCol)
               {
                  list($oppAscOrDesc,$arrow) = $this->ascOrDesc == 'asc' ? array('desc','&uarr;') : array('asc','&darr;');
                  $html .= '<td '.$colHeaderInfo.' ><a href="javascript: void(0);" onclick="'.$this->instanceName.'.toAjaxTableEditor(\'order_by_changed\', new Array(\''.$col.'\',\''.$oppAscOrDesc.'\'),{updateHistory: true});">'.$info['display_text'].'</a> '.$arrow.'</td>';
               }
               else
               {
                  $html .= '<td '.$colHeaderInfo.' ><a href="javascript: void(0);" onclick="'.$this->instanceName.'.toAjaxTableEditor(\'order_by_changed\', new Array(\''.$col.'\',\'asc\'),{updateHistory: true});">'.$info['display_text'].'</a></td>';         
               }
            }
         }
         foreach($this->userColumns as $column)
         {
            $colHeaderInfo = isset($column['col_header_info']) ? $column['col_header_info'] : '';
            $html .= isset($column['title']) ? '<td '.$colHeaderInfo.'>'.$column['title'].'</td>' : '<td '.$colHeaderInfo.'>&nbsp;</td>';
         }
         if(stristr($this->permissions,'I') && $this->iconColPosition == 'last')
         {
            $html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td>&nbsp;</td>';
         }
         $html .= '</tr>';//Fin cabecera arriba
      }

      if($mysqlNumRows > 0 || $this->addInPlace)
      {
         //$bgColor = $this->evenRowColor;
         while($row = mysql_fetch_assoc($result))
         {
            $numRows++;
            $html .= $this->getRowHtml($row,$numRows);
         }
         if(count($this->columnTotals) > 0 && $this->editInPlace == false && $this->addInPlace == false)
         {
            $numRows++;
            $html .= $this->getTotalRowHtml($numRows);
         }


####################################


         $html .= '<tr id="'.$this->instanceName.'header_row2" class="header">';
         if(stristr($this->permissions,'I') && $this->iconColPosition == 'first')
         {
            $html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td>&nbsp;</td>';
         }
         
         foreach($this->tableColumns as $col => $info)
         {
            if(stristr($info['perms'],'T') && !$this->columnIsHidden($info))
            {
               $orderCol = isset($info['order_mask']) ? $this->stripTickMarks($info['order_mask']) : $col;
               $colHeaderInfo = isset($info['col_header_info']) ? $info['col_header_info'] : '';
               if($this->stripTickMarks($this->orderByColumn) == $orderCol)
               {
                  list($oppAscOrDesc,$arrow) = $this->ascOrDesc == 'asc' ? array('desc','&uarr;') : array('asc','&darr;');
                  $html .= '<td '.$colHeaderInfo.' ><a href="javascript: void(0);" onclick="'.$this->instanceName.'.toAjaxTableEditor(\'order_by_changed\', new Array(\''.$col.'\',\''.$oppAscOrDesc.'\'),{updateHistory: true});">'.$info['display_text'].'</a> '.$arrow.'</td>';
               }
               else
               {
                  $html .= '<td '.$colHeaderInfo.' ><a href="javascript: void(0);" onclick="'.$this->instanceName.'.toAjaxTableEditor(\'order_by_changed\', new Array(\''.$col.'\',\'asc\'),{updateHistory: true});">'.$info['display_text'].'</a></td>';         
               }
            }
         }
         if(stristr($this->permissions,'I') && $this->iconColPosition == 'last')
         {
            $html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td>&nbsp;</td>';
         }
         $html .= '</tr>';



#######################################################



         $html .= '</table>';
         $html .= '</form>';
         $html .= '<input type="hidden" id="'.$this->instanceName.'last_row_num" value="'.$numRows.'" />';
         $html .= '</div>';
      }
      else
      {
         $html .= '</table></form></div>';
         $html .= '<div><b>'.$this->langVars->ttlNoRecord.'</b></div>';
      }
      
      $this->setInnerHtml('tableLayer',$html);
   
      if($this->recordInfo)
      {
         if($this->numResults > 0 || $this->addInPlace)
         {
            $end = $this->displayNum + $this->start;
            $end = $end < $this->numResults ? $end : $this->numResults;
            $start = $this->numResults > 0 ? $this->start + 1 : 0;
            $recordHtml = '<div>'.sprintf($this->langVars->ttlDispRecs,$this->instanceName,$start,$this->instanceName,$end,$this->instanceName,number_format($this->numResults)).'</div>';
         }
         else
         {
            $recordHtml = '<div>'.$this->langVars->ttlDispNoRecs.'</div>';
         }
         $this->setInnerHtml('recordLayer',$recordHtml);
      }
   }
galoagui
 
Posts: 24
Joined: Fri Apr 13, 2012 11:20 am

Re: addInPlace under Table Titles

Postby hexxamillion » Wed Oct 21, 2015 7:08 pm

galoagui wrote:Sure!

I've modified the function displayTableHtml In php/AjaxTableEditor.php.

The new code is between##


Code: Select all
function displayTableHtml()
   {
      $html = '';
      $numRows = 0;
      $this->extraOrderByInfo = empty($this->extraOrderByInfo) ? '' : ', '.$this->extraOrderByInfo;
      // Added tick marks using implod/explode in case custom order by columns have periods in them.
      $query = $this->selectClause.' '.$this->joinClause.' '.$this->whereClause.' '.$this->groupByClause.' '.$this->havingClause.' order by '.$this->orderByColumn.' '.$this->getAscOrDesc().' '.$this->extraOrderByInfo.' limit '.$this->start.', '.$this->displayNum;
      if($this->viewQuery)
      {
         $this->information[] = '<div id="'.$this->instanceName.'mateViewQuery" align="left">'.nl2br($query).'</div>';
      }
      $result = $this->doQuery($query);
      $mysqlNumRows = mysql_num_rows($result);
      $html .= '<div>';
      $html .= '<form id="'.$this->instanceName.'table_form" style="margin: 0px;" onsubmit="return false;">';
      $html .= '<table '.$this->tableInfo.'>';
      if($mysqlNumRows > 0 || stristr($this->permissions,'F') || $this->addInPlace)
      {
         $html .= '<tr id="'.$this->instanceName.'header_row" class="header">';
         if(stristr($this->permissions,'M'))
         {
            $html .= '<td id="'.$this->instanceName.'select_all_cb_cell" width="40" align="left"><input type="checkbox" id="'.$this->instanceName.'select_all_cb" onclick="'.$this->instanceName.'.selectCbs(this);" /></td>';
         }
         
         if(stristr($this->permissions,'I') && $this->iconColPosition == 'first')
         {
            $html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td>&nbsp;</td>';
         }
         
         foreach($this->tableColumns as $col => $info)
         {
            if(stristr($info['perms'],'T') && !$this->columnIsHidden($info))
            {
               $orderCol = isset($info['order_mask']) ? $this->stripTickMarks($info['order_mask']) : $col;
               $colHeaderInfo = isset($info['col_header_info']) ? $info['col_header_info'] : '';
               if(stristr($this->permissions,'F') && stristr($info['perms'],'F'))
               {
                  $filterStr = isset($this->filterSearches[$col]) ? $this->filterSearches[$col] : '';
                  $filterData = $this->jsonEncode(array($col,$filterStr));
                  //var_dump($filterData);
                  //$colHeaderInfo .= ' headers="'.$filterData.'"';
                  $colHeaderInfo .= ' filterCol="'.$col.'" filterStr="'.htmlspecialchars($filterStr).'"';
               }
               if($this->stripTickMarks($this->orderByColumn) == $orderCol)
               {
                  list($oppAscOrDesc,$arrow) = $this->ascOrDesc == 'asc' ? array('desc','&uarr;') : array('asc','&darr;');
                  $html .= '<td '.$colHeaderInfo.' ><a href="javascript: void(0);" onclick="'.$this->instanceName.'.toAjaxTableEditor(\'order_by_changed\', new Array(\''.$col.'\',\''.$oppAscOrDesc.'\'),{updateHistory: true});">'.$info['display_text'].'</a> '.$arrow.'</td>';
               }
               else
               {
                  $html .= '<td '.$colHeaderInfo.' ><a href="javascript: void(0);" onclick="'.$this->instanceName.'.toAjaxTableEditor(\'order_by_changed\', new Array(\''.$col.'\',\'asc\'),{updateHistory: true});">'.$info['display_text'].'</a></td>';         
               }
            }
         }
         foreach($this->userColumns as $column)
         {
            $colHeaderInfo = isset($column['col_header_info']) ? $column['col_header_info'] : '';
            $html .= isset($column['title']) ? '<td '.$colHeaderInfo.'>'.$column['title'].'</td>' : '<td '.$colHeaderInfo.'>&nbsp;</td>';
         }
         if(stristr($this->permissions,'I') && $this->iconColPosition == 'last')
         {
            $html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td>&nbsp;</td>';
         }
         $html .= '</tr>';//Fin cabecera arriba
      }

      if($mysqlNumRows > 0 || $this->addInPlace)
      {
         //$bgColor = $this->evenRowColor;
         while($row = mysql_fetch_assoc($result))
         {
            $numRows++;
            $html .= $this->getRowHtml($row,$numRows);
         }
         if(count($this->columnTotals) > 0 && $this->editInPlace == false && $this->addInPlace == false)
         {
            $numRows++;
            $html .= $this->getTotalRowHtml($numRows);
         }


####################################


         $html .= '<tr id="'.$this->instanceName.'header_row2" class="header">';
         if(stristr($this->permissions,'I') && $this->iconColPosition == 'first')
         {
            $html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td>&nbsp;</td>';
         }
         
         foreach($this->tableColumns as $col => $info)
         {
            if(stristr($info['perms'],'T') && !$this->columnIsHidden($info))
            {
               $orderCol = isset($info['order_mask']) ? $this->stripTickMarks($info['order_mask']) : $col;
               $colHeaderInfo = isset($info['col_header_info']) ? $info['col_header_info'] : '';
               if($this->stripTickMarks($this->orderByColumn) == $orderCol)
               {
                  list($oppAscOrDesc,$arrow) = $this->ascOrDesc == 'asc' ? array('desc','&uarr;') : array('asc','&darr;');
                  $html .= '<td '.$colHeaderInfo.' ><a href="javascript: void(0);" onclick="'.$this->instanceName.'.toAjaxTableEditor(\'order_by_changed\', new Array(\''.$col.'\',\''.$oppAscOrDesc.'\'),{updateHistory: true});">'.$info['display_text'].'</a> '.$arrow.'</td>';
               }
               else
               {
                  $html .= '<td '.$colHeaderInfo.' ><a href="javascript: void(0);" onclick="'.$this->instanceName.'.toAjaxTableEditor(\'order_by_changed\', new Array(\''.$col.'\',\'asc\'),{updateHistory: true});">'.$info['display_text'].'</a></td>';         
               }
            }
         }
         if(stristr($this->permissions,'I') && $this->iconColPosition == 'last')
         {
            $html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td>&nbsp;</td>';
         }
         $html .= '</tr>';



#######################################################



         $html .= '</table>';
         $html .= '</form>';
         $html .= '<input type="hidden" id="'.$this->instanceName.'last_row_num" value="'.$numRows.'" />';
         $html .= '</div>';
      }
      else
      {
         $html .= '</table></form></div>';
         $html .= '<div><b>'.$this->langVars->ttlNoRecord.'</b></div>';
      }
      
      $this->setInnerHtml('tableLayer',$html);
   
      if($this->recordInfo)
      {
         if($this->numResults > 0 || $this->addInPlace)
         {
            $end = $this->displayNum + $this->start;
            $end = $end < $this->numResults ? $end : $this->numResults;
            $start = $this->numResults > 0 ? $this->start + 1 : 0;
            $recordHtml = '<div>'.sprintf($this->langVars->ttlDispRecs,$this->instanceName,$start,$this->instanceName,$end,$this->instanceName,number_format($this->numResults)).'</div>';
         }
         else
         {
            $recordHtml = '<div>'.$this->langVars->ttlDispNoRecs.'</div>';
         }
         $this->setInnerHtml('recordLayer',$recordHtml);
      }
   }


I see. It looks like this just duplicates the header. I was trying to see how to duplicate the add in place row to the top of the table.
hexxamillion
 
Posts: 100
Joined: Fri Jul 08, 2011 11:36 pm


Return to Paid Version

Who is online

Users browsing this forum: No registered users and 4 guests

cron