Anonymous

Livestream sandbox: Difference between revisions

From Wikibok
no edit summary
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Result format
| format name=broadtable
| authors=Markus Krötzsch
| minimum version=0.4
| maximum version=still supported
| further reqs=none
| component=Semantic MediaWiki
| categories=misc
| description=Outputs the results in a broad table.
}}
The [[Help:Result formats|result format]] '''broadtable''' is used to format query results as tables. It is identical to the [[Help:Table format|table]] format except that the broadtable stretches the table to 100% of the available width.
== Parameters ==
=== General ===
{{#smwdoc:broadtable|parameters=base}}
{{Note}} The parameter <code>headers=hide</code> is specifically useful for hiding the header of tables (in most other cases, it is enough to use empty printout labels to hide the titles of printout statements).
=== Format specific ===
{{#smwdoc:broadtable|parameters=specific}}
== Sorting==
Tables have a special feature for sorting their contents by any of the columns in the table. See [[Help:Selecting pages]] for general comments on sorting and a comparison to the wiki's query result sorting. Browsers without JavaScript enabled will not see the buttons for sorting at all.
== Example ==
== Example ==
<pre>
<pre>
Line 9: Line 34:
  | mainlabel = City
  | mainlabel = City
}}
}}
{| class="wikitable"
| Orange || Apple    || style="text-align:right;" | 12,333.00
|-
| Bread || Pie      || style="text-align:right;" | 500.00
|-
| Butter || Ice cream || style="text-align:right;" | 1.00
|}
</pre>
</pre>


Line 29: Line 61:
}}
}}
</div>{{HIDE CAT PREFIX|Tagcloud/}}
</div>{{HIDE CAT PREFIX|Tagcloud/}}
== Applying CSS formatting ==
As of [[Semantic MediaWiki 1.6.2]] the native MediaWiki sortable tables are used. Thus this format now provides several ways for custom formatting to be applied to tables:
* One or more overall CSS classes can be set for the table, using the "class=" parameter.
* Each column in the table gets a class name that derives from the column name. For instance, if a column is titled "Capital city", the column's class will be "Capital-city".
* Rows in the table each get either the class "row-odd" or "row-even", depending on whether the row is odd or even.
In this way, specific formatting, like colors and font sizes, can be set across a single table, or for a specific column, or can be set for alternating rows. The recommended way to set any custom CSS in the wiki is by modifying the page "MediaWiki:Common.css".
; Example for alternating row colours
The example below will result in the display of alternating rows.
<syntaxhighlight lang="css">
/* even and odd in tables */
.smwtable .row-even {
    background-color: #fff;
}
.smwtable .row-odd {
    background-color: #cde6ea;
}
</syntaxhighlight >
=== Data value type attributes ===
[[Semantic MediaWiki 1.9.0]] introduces type related attribution allowing to apply specific formatting rules based on the datatype uses (data value types like "<code>_dat</code>", "<code>_num</code>" etc.) used in a column.[[CiteRef::gerrit:smw:53520]]
The class attribute is a concatenated string that includes "<code>smwtype</code>" + "<code>datavalue typeId</code>" resulting in "<code>smwtype_dat</code>" for the data value of datatype [[Help:Type Date|"Date"]]. If you want all numeric representations (prerequisite is that the property selected for display is of datatype [[Help:Type Number|"Number"]]) in a table to be formatted on the right side, you would need to add:
<syntaxhighlight lang="css">
/* DataValue type formatting */
.smwtable .smwtype_num {
    text-align: right;
}
</syntaxhighlight >
== Examples ==
{{#ask:
[[Category:Result format example]]
[[Has keyword::example||broadtable format]]
|format=ul
}}
{{Styling option|styling=Type class attribute|description=Adopt type related formatting}}
{{Styling option|styling=Row class attribute|description=Adopt row formatting}}
{{DEFAULTSORTKEY:Broadable}}
{{docinfo
| master page = Help:Broadtable format
| master rev  = {{REVISIONID}}
| master link = internal
| status  = effective
| progress = 100
| priority = 3
| category = Result formats
| author = Markus Krötzsch
| editor = {{REVISIONUSER}}
| support = Kghbln
| minversion = 1.6.2
| lang = en
| desc =
| return =
| nowarn
}}
Bureaucrats, developer, smwadministrator, Administrators
10,675

edits