mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
implement part attribute with values "header" and "footer" to put rows in thead or tfoot instead of tbody of table
This commit is contained in:
parent
984bbf4d44
commit
3d05a43417
14
etemplate/inc/class.etemplate_table_test.inc.php
Normal file
14
etemplate/inc/class.etemplate_table_test.inc.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
class etemplate_table_test
|
||||
{
|
||||
var $public_functions = array(
|
||||
'index' => true,
|
||||
);
|
||||
|
||||
function index(array $content=null, $msg='')
|
||||
{
|
||||
$tmpl = new etemplate_new('etemplate.table_test');
|
||||
$content = array();
|
||||
$tmpl->exec('etemplate.etemplate_table_test.index', $content);
|
||||
}
|
||||
}
|
@ -62,10 +62,14 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned, et2_IResize
|
||||
*/
|
||||
init: function() {
|
||||
// Create the table body and the table
|
||||
this.tbody = $j(document.createElement("tbody"));
|
||||
this.table = $j(document.createElement("table"))
|
||||
.addClass("et2_grid");
|
||||
this.table.append(this.tbody);
|
||||
this.thead = $j(document.createElement("thead"))
|
||||
.appendTo(this.table);
|
||||
this.tfoot = $j(document.createElement("tfoot"))
|
||||
.appendTo(this.table);
|
||||
this.tbody = $j(document.createElement("tbody"))
|
||||
.appendTo(this.table);
|
||||
|
||||
// Call the parent constructor
|
||||
this._super.apply(this, arguments);
|
||||
@ -212,6 +216,7 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned, et2_IResize
|
||||
rowDataEntry["class"] = et2_readAttrWithDefault(node, "class", "");
|
||||
rowDataEntry["valign"] = et2_readAttrWithDefault(node, "valign", "");
|
||||
rowDataEntry["span"] = et2_readAttrWithDefault(node, "span", "1");
|
||||
rowDataEntry["part"] = et2_readAttrWithDefault(node, "part", "body");
|
||||
|
||||
var id = et2_readAttrWithDefault(node, "id", "");
|
||||
if(id)
|
||||
@ -645,7 +650,23 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned, et2_IResize
|
||||
for (var y = 0; y < h; y++)
|
||||
{
|
||||
var row = _cells[y];
|
||||
var tr = $j(document.createElement("tr")).appendTo(this.tbody)
|
||||
var parent = this.tbody;
|
||||
switch(this.rowData[y]["part"])
|
||||
{
|
||||
case 'header':
|
||||
if (!this.tbody.children().length && !this.tfoot.children().length)
|
||||
{
|
||||
parent = this.thead;
|
||||
}
|
||||
break;
|
||||
case 'footer':
|
||||
if (!this.tbody.children().length)
|
||||
{
|
||||
parent = this.tfoot;
|
||||
}
|
||||
break;
|
||||
}
|
||||
var tr = $j(document.createElement("tr")).appendTo(parent)
|
||||
.addClass(this.rowData[y]["class"]);
|
||||
|
||||
if (this.rowData[y].disabled)
|
||||
@ -838,6 +859,8 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned, et2_IResize
|
||||
}
|
||||
}
|
||||
this.managementArray = [];
|
||||
this.thead.empty();
|
||||
this.tfoot.empty();
|
||||
this.tbody.empty();
|
||||
|
||||
// Update array managers
|
||||
|
33
etemplate/templates/default/table_test.xet
Normal file
33
etemplate/templates/default/table_test.xet
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="etemplate.table_test" template="" lang="" group="0" version="">
|
||||
<grid id="rows" order="first" sort="asc" onsort="alert">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row part="header">
|
||||
<description value="Header" span="all"/>
|
||||
<description/>
|
||||
</row>
|
||||
<row part="footer">
|
||||
<description value="Footer" span="all"/>
|
||||
<description/>
|
||||
</row>
|
||||
<row class="th">
|
||||
<grid-sortheader label="Col 1 Header" id="first" custom-sort="app.method"/>
|
||||
<grid-sortheader label="Col 2 Header" id="second"/>
|
||||
<description value="Col 3 Header"/>
|
||||
</row>
|
||||
<row class="row">
|
||||
<description id="${row}[first]"/>
|
||||
<description id="${row}[second]"/>
|
||||
<description id="${row}[third]"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user