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 wrote:finally, i've duplicated the header but in bottom position
So, i see the fields when i use addInPlace
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> </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','↑') : array('asc','↓');
$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.'> </td>';
}
if(stristr($this->permissions,'I') && $this->iconColPosition == 'last')
{
$html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td> </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> </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','↑') : array('asc','↓');
$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> </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 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> </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','↑') : array('asc','↓');
$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.'> </td>';
}
if(stristr($this->permissions,'I') && $this->iconColPosition == 'last')
{
$html .= strlen($this->iconTitle) > 0 ? '<td>'.$this->iconTitle.'</td>' : '<td> </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> </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','↑') : array('asc','↓');
$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> </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);
}
}
Users browsing this forum: No registered users and 4 guests