You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2016/08/10 08:40:15 UTC
svn commit: r1755692 - in /myfaces/tobago/trunk:
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/model/
tobago-example/tobago-example-demo/src/main/webapp/content/20-component/...
Author: lofwyr
Date: Wed Aug 10 08:40:15 2016
New Revision: 1755692
URL: http://svn.apache.org/viewvc?rev=1755692&view=rev
Log:
TOBAGO-1578:
* 'showHeader' attribute can be used without the 'columns' attribute of tc:sheet
* <tc:sheet columns="..."> can now handle "px" and "%"
* column resizing improved (can now handle not rendered columns)
* multi-header implemented (title is centered if the header span more than one column)
[developed by hnoeth]
Modified:
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SheetState.java
myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/60-multiheader/sheet-multi-header.xhtml
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java?rev=1755692&r1=1755691&r2=1755692&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISheet.java Wed Aug 10 08:40:15 2016
@@ -419,11 +419,12 @@ public abstract class AbstractUISheet ex
rows.addToken(AutoLayoutToken.INSTANCE);
final Grid grid = new Grid(tokens, rows);
- for(final UIComponent child : header.getChildren()) {
- if (child.isRendered()) {
-// XXX not implemented in the moment grid.add(new OriginCell(child), c.getColumnSpan(), c.getRowSpan());
- grid.add(new OriginCell(child), 1, 1);
- }
+ for (final UIComponent child : header.getChildren()) {
+ if (child.isRendered()) {
+ int columnSpan = ComponentUtils.getIntAttribute(child, Attributes.columnSpan, 1);
+ int rowSpan = ComponentUtils.getIntAttribute(child, Attributes.rowSpan, 1);
+ grid.add(new OriginCell(child), columnSpan, rowSpan);
+ }
}
setHeaderGrid(grid);
}
Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SheetState.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SheetState.java?rev=1755692&r1=1755691&r2=1755692&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SheetState.java (original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SheetState.java Wed Aug 10 08:40:15 2016
@@ -114,6 +114,15 @@ public class SheetState implements Seria
this.columnWidths = columnWidths;
}
+ public boolean isDefinedColumnWidths() {
+ for (Integer columnWidth : columnWidths) {
+ if(columnWidth < 0) {
+ return false;
+ }
+ }
+ return columnWidths.size() > 0;
+ }
+
public int getFirst() {
return first;
}
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/60-multiheader/sheet-multi-header.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/60-multiheader/sheet-multi-header.xhtml?rev=1755692&r1=1755691&r2=1755692&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/60-multiheader/sheet-multi-header.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/20-component/080-sheet/60-multiheader/sheet-multi-header.xhtml Wed Aug 10 08:40:15 2016
@@ -22,25 +22,41 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core">
<ui:param name="title" value="#{overviewBundle.sheet}"/>
-
- <tc:panel>
- <f:facet name="layout">
- <tc:gridLayout rows="1*;5*"/>
- </f:facet>
-
- <tc:out value="For simple column headers, use the lable attribute of the tc:column.
- For more complex headers, which can span over columns and/or rows use a <f:facet name='header'> in the sheet." />
-
- <tc:sheet value="#{sheetController.solarList}" id="sheet"
- columns="3*;2*;30px;2*;2*;2*;2*;2*;2*" var="luminary"
- state="#{sheetController.sheetState}"
- showRowRange="left"
- showPageRange="right"
- showDirectLinks="center">
-
+ <p>For more complex headers, which can span over columns and/or rows use a
+ <code class="language-markup"><f:facet name="header"></code>in the sheet.
+ The facet could be filled with <code class="language-markup"><tc:out/></code> tags
+ to set the names of the header.
+ Such an outputfield tag may also contain
+ <code class="language-markup"><tc:gridLayoutConstraint columnSpan="..."/></code>
+ or
+ <code class="language-markup"><tc:gridLayoutConstraint rowSpan="..."/></code>
+ to set a span over columns or rows.</p>
+ <p>Tag Library Documentation:
+ <tc:link label="<tc:sheet/>" image="image/feather-leaf.png"
+ link="#{overviewBundle.tagDocUrl}/sheet.html"/>
+ |
+ <tc:link label="<tc:column/>" image="image/feather-leaf.png"
+ link="#{overviewBundle.tagDocUrl}/column.html"/>
+ |
+ <tc:link label="<tc:gridLayoutConstraint/>" image="image/feather-leaf.png"
+ link="#{overviewBundle.tagDocUrl}/gridLayoutConstraint.html"/></p>
+
+ <tc:section label="Multi-Header">
+ <p>For multi-header sheets, you should consider to use <code>markup="bordered"</code> for better appearance.</p>
+ <pre><code class="language-markup"><tc:sheet value="\#{sheetController.solarList}" var="luminary" rows="11"
+ columns="3*;2*;30px;2*;2*;2*;2*;2*;2*" markup="bordered">
+ <f:facet name="header">
+ <tc:out value="Name">
+ <tc:gridLayoutConstraint rowSpan="3"/>
+ </tc:out>
+ <tc:out value="Information">
+ <tc:gridLayoutConstraint columnSpan="2"/>
+ ...</code></pre>
+ <tc:sheet value="#{sheetController.solarList}" var="luminary" rows="11"
+ columns="3*;2*;30px;2*;2*;2*;2*;2*;2*" markup="bordered">
<f:facet name="header">
<tc:panel>
- <tc:out value="#{overviewBundle.solarArrayName}">
+ <tc:out value="Name">
<tc:gridLayoutConstraint rowSpan="3"/>
</tc:out>
<tc:out value="Information">
@@ -67,43 +83,41 @@
</tc:out>
<tc:out value="of"/>
- <tc:out value="#{overviewBundle.solarArrayNumber}"/>
- <tc:out value="#{overviewBundle.solarArrayDistance} [1000 km]"/>
+ <tc:out value="#"/>
+ <tc:out value="Distance [1000 km]"/>
<tc:out value="Period [days]"/>
<tc:out value="Inclination [°]"/>
<tc:out value="Eccentricity"/>
-
</tc:panel>
</f:facet>
- <tc:column id="name">
- <tc:out value="#{luminary.name}" id="t_name"/>
+ <tc:column align="center">
+ #{luminary.name}
</tc:column>
- <tc:column id="orbit" label="#{overviewBundle.solarArrayOrbit}" sortable="true">
- <tc:out value="#{luminary.orbit}" id="t_orbit"/>
+ <tc:column sortable="true">
+ #{luminary.orbit}
</tc:column>
- <tc:column id="number" sortable="false" resizable="false"
- tip="#{overviewBundle.solarArrayNumberTip}" align="center">
- <tc:out value="#{luminary.number}" id="t_number"/>
+ <tc:column align="center">
+ #{luminary.number}
</tc:column>
- <tc:column sortable="true" align="right" id="distance">
- <tc:out value="#{luminary.distance}" id="t_distance"/>
+ <tc:column align="right" sortable="true">
+ #{luminary.distance}
</tc:column>
- <tc:column label="#{overviewBundle.solarArrayPeriod}" sortable="true" align="right" id="period">
- <tc:out value="#{luminary.period}" id="t_period"/>
+ <tc:column align="right" sortable="true">
+ #{luminary.period}
</tc:column>
- <tc:column sortable="true" align="right" id="incl">
- <tc:out value="#{luminary.incl}" id="t_incl"/>
+ <tc:column align="right" sortable="true">
+ #{luminary.incl}
</tc:column>
- <tc:column sortable="true" align="right" id="eccen">
- <tc:out value="#{luminary.eccen}" id="t_eccen"/>
+ <tc:column align="right" sortable="true">
+ #{luminary.eccen}
</tc:column>
- <tc:column sortable="true" id="discoverer">
- <tc:out value="#{luminary.discoverer}" id="t_discoverer"/>
+ <tc:column sortable="true">
+ #{luminary.discoverer}
</tc:column>
- <tc:column sortable="true" align="center" id="discoverYear">
- <tc:out value="#{luminary.discoverYear}" id="t_discoverYear"/>
+ <tc:column align="center" sortable="true">
+ #{luminary.discoverYear}
</tc:column>
</tc:sheet>
- </tc:panel>
+ </tc:section>
</ui:composition>
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java?rev=1755692&r1=1755691&r2=1755692&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/Command.java Wed Aug 10 08:40:15 2016
@@ -113,7 +113,8 @@ public class Command {
command.isTransition(),
command.getTarget(),
RenderUtils.generateUrl(facesContext, command),
- ComponentUtils.evaluateClientIds(facesContext, command, command.getRenderedPartially()),
+ ComponentUtils.evaluateClientIds(facesContext, command, command.getExecutePartially()),
+ ComponentUtils.evaluateClientIds(facesContext, command, command.getRenderPartially()),
null,
getConfirmation(command),
null,
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java?rev=1755692&r1=1755691&r2=1755692&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SheetRenderer.java Wed Aug 10 08:40:15 2016
@@ -97,6 +97,7 @@ public class SheetRenderer extends Rende
private static final Logger LOG = LoggerFactory.getLogger(SheetRenderer.class);
private static final String SUFFIX_WIDTHS = ComponentUtils.SUB_SEPARATOR + "widths";
+ private static final String SUFFIX_COLUMN_RENDERED = ComponentUtils.SUB_SEPARATOR + "rendered";
private static final String SUFFIX_SCROLL_POSITION = ComponentUtils.SUB_SEPARATOR + "scrollPosition";
private static final String SUFFIX_SELECTED = ComponentUtils.SUB_SEPARATOR + "selected";
private static final String SUFFIX_SELECTOR_DROPDOWN = ComponentUtils.SUB_SEPARATOR + "selectorDropdown";
@@ -231,7 +232,7 @@ public class SheetRenderer extends Rende
final Application application = facesContext.getApplication();
final SheetState state = sheet.getSheetState(facesContext);
final List<Integer> columnWidths = sheet.getState().getColumnWidths();
- final boolean cleanColumnWidths = columnWidths.size() == 0;
+ final boolean definedColumnWidths = sheet.getState().isDefinedColumnWidths();
final List<Integer> selectedRows = getSelectedRows(sheet, state);
final List<AbstractUIColumnBase> columns = sheet.getAllColumns();
final boolean showHeader = sheet.isShowHeader();
@@ -245,18 +246,26 @@ public class SheetRenderer extends Rende
writer.writeIdAttribute(sheetId + SUFFIX_WIDTHS);
writer.writeNameAttribute(sheetId + SUFFIX_WIDTHS);
writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
- if (!cleanColumnWidths) {
+ if (definedColumnWidths) {
final List<Integer> encodedWidths = new ArrayList<Integer>(columnWidths.size());
for (int i = 0; i < columns.size(); i++) {
- AbstractUIColumnBase column = columns.get(i);
- if (column.isRendered()) {
- final Integer width = columnWidths.get(i);
- encodedWidths.add(width > -1 ? width : 100);
- }
+ final Integer width = columnWidths.get(i);
+ encodedWidths.add(width > -1 ? width : 100);
}
writer.writeAttribute(HtmlAttributes.VALUE, JsonUtils.encode(encodedWidths), false);
}
writer.endElement(HtmlElements.INPUT);
+
+ writer.startElement(HtmlElements.INPUT);
+ writer.writeIdAttribute(sheetId + SUFFIX_COLUMN_RENDERED);
+ writer.writeNameAttribute(sheetId + SUFFIX_COLUMN_RENDERED);
+ writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN);
+ final String[] encodedRendered = new String[columns.size()];
+ for (int i = 0; i < encodedRendered.length; i++) {
+ encodedRendered[i] = columns.get(i).isRendered() ? "true" : "false";
+ }
+ writer.writeAttribute(HtmlAttributes.VALUE, JsonUtils.encode(encodedRendered), false);
+ writer.endElement(HtmlElements.INPUT);
}
final String clientId = sheet.getClientId(facesContext);
@@ -331,11 +340,13 @@ public class SheetRenderer extends Rende
sheetMarkup.contains(Markup.SMALL) ? BootstrapClass.TABLE_SM : null,
!autoLayout ? TobagoClass.TABLE_LAYOUT__FIXED : null);
- if (autoLayout) {
+ if (showHeader && autoLayout) {
writer.startElement(HtmlElements.THEAD);
encodeHeaderRows(facesContext, sheet, writer, columns);
writer.endElement(HtmlElements.THEAD);
- } else {
+ }
+
+ if (!autoLayout) {
writeColgroup(writer, columnWidths, columns);
}
@@ -690,7 +701,7 @@ public class SheetRenderer extends Rende
for (int i = 0, j = 0; i < columns.size(); i++) {
AbstractUIColumnBase column = columns.get(i);
Integer newValue;
- if (column.isRendered() && j < samples.size()) {
+ if (j < samples.size()) {
newValue = samples.get(j);
j++;
} else {
@@ -731,6 +742,7 @@ public class SheetRenderer extends Rende
final Selectable selectable = sheet.getSelectable();
final Grid grid = sheet.getHeaderGrid();
final boolean autoLayout = sheet.isAutoLayout();
+ final boolean multiHeader = grid.getRowCount() > 1;
int offset = 0;
for (int i = 0; i < grid.getRowCount(); i++) {
@@ -756,7 +768,9 @@ public class SheetRenderer extends Rende
writer.startElement(HtmlElements.DIV);
final CssItem align;
final String alignString = ComponentUtils.getStringAttribute(column, Attributes.align);
- if (alignString != null) {
+ if(multiHeader && cell.getColumnSpan() > 1) {
+ align = TobagoClass.SHEET__CELL__MARKUP__CENTER;
+ } else if (alignString != null) {
switch (TextAlign.valueOf(alignString)) {
case right:
align = TobagoClass.SHEET__CELL__MARKUP__RIGHT;
@@ -1014,6 +1028,7 @@ public class SheetRenderer extends Rende
if (target != null) {
ComponentUtils.setAttribute(command, Attributes.pagingTarget, target);
}
+ command.setExecutePartially(new String[]{data.getId()});
command.setRenderPartially(new String[]{data.getId()});
final Locale locale = facesContext.getViewRoot().getLocale();
Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js?rev=1755692&r1=1755691&r2=1755692&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-sheet.js Wed Aug 10 08:40:15 2016
@@ -129,45 +129,61 @@ Tobago.Sheet.setup2 = function (sheets)
console.info("columnWidths: " + columnWidths); // @DEV_ONLY
console.info(columnWidths); // @DEV_ONLY
} else {
- // otherwize use the layout definition
+ // otherwise use the layout definition
var layout = $sheet.data("tobago-layout");
if (layout && layout.columns && layout.columns.length > 0) {
var tokens = layout.columns;
+ var rendered = jQuery.parseJSON(Tobago.Sheet.findHiddenRendered($sheet).val());
var $headerTable = $sheet.children("header").children("table");
var $headerCol = $headerTable.children("colgroup").children("col");
var $bodyTable = $sheet.children("div").children("table");
var $bodyCol = $bodyTable.children("colgroup").children("col");
- console.assert(tokens.length == $bodyCol.length, "layout and body column number doesn't match"); // @DEV_ONLY
console.assert($headerCol.length == $bodyCol.length, "header and body column number doesn't match"); // @DEV_ONLY
var i;
var sumRelative = 0;
+ var widthRelative = $bodyTable.width();
for (i = 0; i < tokens.length; i++) {
- if (typeof tokens[i] == "number") {
- sumRelative += tokens[i];
- } else {
- console.warn("not implemented yet: '" + tokens[i] + "'");
+ if (rendered[i] == "true") {
+ if (typeof tokens[i] == "number") {
+ sumRelative += tokens[i];
+ } else if (typeof tokens[i] == "object" && tokens[i].measure != undefined) {
+ var intValue = parseInt(tokens[i].measure);
+ if (tokens[i].measure.lastIndexOf("px") > 0) {
+ widthRelative -= intValue;
+ } else if (tokens[i].measure.lastIndexOf("%") > 0) {
+ widthRelative -= parseInt($bodyTable.width() / 100 * intValue);
+ }
+ }
}
}
+ if (widthRelative < 0) {
+ widthRelative = 0;
+ }
- var width = $bodyTable.width();
-
+ var headerBodyColCount = 0;
for (i = 0; i < tokens.length; i++) {
- if (typeof tokens[i] == "number") {
-
- var colWidth = (tokens[i] * width) / sumRelative;
- $headerCol.eq(i).attr("width", colWidth);
- $bodyCol.eq(i).attr("width", colWidth);
- } else {
- console.warn("not implemented yet: '" + tokens[i] + "'");
+ var colWidth = 0;
+ if (rendered[i] == "true") {
+ if (typeof tokens[i] == "number") {
+ colWidth = parseInt((tokens[i] * widthRelative) / sumRelative);
+ } else if (typeof tokens[i] == "object" && tokens[i].measure != undefined) {
+ var intValue = parseInt(tokens[i].measure);
+ if (tokens[i].measure.lastIndexOf("px") > 0) {
+ colWidth = intValue;
+ } else if (tokens[i].measure.lastIndexOf("%") > 0) {
+ colWidth = parseInt($bodyTable.width() / 100 * intValue);
+ }
+ }
+ $headerCol.eq(headerBodyColCount).attr("width", colWidth);
+ $bodyCol.eq(headerBodyColCount).attr("width", colWidth);
+ headerBodyColCount++;
}
}
-
}
}
-
});
// resize: mouse events
@@ -215,6 +231,13 @@ Tobago.Sheet.setup2 = function (sheets)
console.info("up"); // @DEV_ONLY
// copy the width values from the header to the body, (and build a list of it)
var sheet = event.data.sheet;
+ var tokens = sheet.data("tobago-layout").columns;
+ var rendered = jQuery.parseJSON(Tobago.Sheet.findHiddenRendered(sheet).val());
+ var hidden = Tobago.Sheet.findHiddenWidths(sheet);
+ var hiddenWidths;
+ if (hidden.length > 0 && hidden.val()) {
+ hiddenWidths = jQuery.parseJSON(hidden.val());
+ }
var headerTable = sheet.find(".tobago-sheet-headerTable");
var bodyTable = sheet.find(".tobago-sheet-bodyTable");
var headerCols = headerTable.find("col");
@@ -226,24 +249,41 @@ Tobago.Sheet.setup2 = function (sheets)
oldWidthList[i] = bodyCols.eq(i).width();
}
var usedWidth = 0;
- for (i = 0; i < headerCols.length -1; i++) {
- // last column is the filler column
- var newWidth = headerCols.eq(i).width();
- // for the hidden field
- widths[i] = newWidth;
- usedWidth += newWidth;
-
- var oldWidth = bodyCols.eq(i).width();
- if (oldWidth != newWidth) {
- // set to the body
- bodyCols.eq(i).attr("width", newWidth);
- // reset the width inside of the cells (TD) if the value was changed.
- var tds = jQuery("td:nth-child(" + (i + 1) + ")", bodyTable);
- if (tds.size() > 0) {
- var innerWidth = tds.children().eq(0).width() - oldWidthList[i] + newWidth;
- // setting all sizes of the inner cells to the same value
- tds.children().width(innerWidth);
- // XXX later, if we have box-sizing: border-box we can set the width to 100%
+ var headerBodyColCount = 0;
+ for (i = 0; i < rendered.length; i++) {
+ if (rendered[i] == "true") {
+ // last column is the filler column
+ var newWidth = headerCols.eq(headerBodyColCount).width();
+ // for the hidden field
+ widths[i] = newWidth;
+ usedWidth += newWidth;
+
+ var oldWidth = bodyCols.eq(headerBodyColCount).width();
+ if (oldWidth != newWidth) {
+ // set to the body
+ bodyCols.eq(headerBodyColCount).attr("width", newWidth);
+ // reset the width inside of the cells (TD) if the value was changed.
+ var tds = jQuery("td:nth-child(" + (headerBodyColCount + 1) + ")", bodyTable);
+ if (tds.size() > 0) {
+ var innerWidth = tds.children().eq(0).width() - oldWidthList[headerBodyColCount] + newWidth;
+ // setting all sizes of the inner cells to the same value
+ tds.children().width(innerWidth);
+ // XXX later, if we have box-sizing: border-box we can set the width to 100%
+ }
+ }
+ headerBodyColCount++;
+ } else if (hiddenWidths != undefined && hiddenWidths.length >= i) {
+ widths[i] = hiddenWidths[i];
+ } else {
+ if (typeof tokens[i] == "number") {
+ widths[i] = 100;
+ } else if (typeof tokens[i] == "object" && tokens[i].measure != undefined) {
+ var intValue = parseInt(tokens[i].measure);
+ if (tokens[i].measure.lastIndexOf("px") > 0) {
+ widths[i] = intValue;
+ } else if (tokens[i].measure.lastIndexOf("%") > 0) {
+ widths[i] = parseInt(bodyTable.width() / 100 * intValue);
+ }
}
}
}
@@ -478,6 +518,11 @@ Tobago.Sheet.findHiddenWidths = function
return jQuery(Tobago.Utils.escapeClientId(id));
};
+Tobago.Sheet.findHiddenRendered = function($sheet){
+ var id = $sheet.attr("id") + Tobago.SUB_COMPONENT_SEP + "rendered";
+ return jQuery(Tobago.Utils.escapeClientId(id));
+};
+
Tobago.Sheet.prototype.setup = function() {
console.time("[tobago-sheet] setup"); // @DEV_ONLY
this.initReload();