File: ./Proj.demo/table.page.php - ver:1.7.3
Open source - π˜“π˜π˜Šπ˜Œπ˜•π˜šπ˜Œ & 𝘊𝘰𝘱𝘺𝘳π˜ͺ𝘨𝘩𝘡 Β© 2019-2026 EV-soft *** See the file: LICENSE
Skip to the contentGo to the view tools

table.page.php



Test site and documentation for Clever html engine β€’ Errors may occur and future news may be shown β€’ ver.1.7.3: 78 core functions.


MOVE: Drag to place this card elsewhere among the cards. Alt + arrow up/down: one place. The order is remembered in this browser.Htm_Table() - a minimal tableTOGGLE: Click icon or card header-text to open / close this card TOGGLE-height: Click icon to toggle viewHeight for this card WIDE: Click to maximize/normalize this card width COLLAPSE: Click to close all cards EXPAND: Click to open all cards
Only body (the columns) and data (the rows) are needed. Each column: label, width, type, format, style, field name.
Name
{Editable}
City
{Editable}
Date
{Editable}

Table-Filtering/Searching: Hold mouse over the colored row below the column headers.
Show the codeHide the code
$people= [['Anna', 'Copenhagen', '2026-10-01'],
          ['Bo',   'Aarhus',     '2026-10-05'],
          ['Carl', 'Odense',     '2026-09-28']];
htm_Table(body: [['@Name', '35%', 'text', '', ['left'],   'name'],
                 ['@City', '35%', 'text', '', ['left'],   'city'],
                 ['@Date', '30%', 'date', '', ['center'], 'date']],
          data: $people, crea: false, vhgh: '160px');
Drag to resize the card (or use the arrow keys). Double-click or Home: original sizeColumn view: the column decides the width of the card - only the height can be dragged (down to less than the content). Turn the column view off to change the width.
MOVE: Drag to place this card elsewhere among the cards. Alt + arrow up/down: one place. The order is remembered in this browser.Column types (body, field 2)TOGGLE: Click icon or card header-text to open / close this card TOGGLE-height: Click icon to toggle viewHeight for this card WIDE: Click to maximize/normalize this card width COLLAPSE: Click to close all cards EXPAND: Click to open all cards
One column of each type. Change some fields and press Save - the card at the top shows what the server receives.
No.
indx: the row number - click it
Item text: an editable field
{Editable}
Note data: like text
{Editable}
Group
show: read only
Date date: a date field
{Editable}
Cur. ddwn: a select - the options in field 9
{Editable}
In stock
chck: a checkbox - posted as checked or empty
Qty.
intg: an integer
HTML
html: the value as HTML (not posted)
Bold?
bold: is the text bold (read only)
Del. Delete the row (it asks first - Undo brings it back)
bold textDelete the row
italicDelete the row
underlineDelete the row
Create an empty row, so you can fill in data in the yellow fields !
Keyboard shortcut: Alt+C
Show the codeHide the code
$items= [['17', '1', 'Hammer', 'Steel, 500 g', 'Tools',   '2026-10-01', 'DKK', 'checked', '12', '<b>bold</b> text', '<b>Yes</b>'],
         ['18', '2', 'Saw',    'Wood saw',     'Tools',   '2026-10-03', 'EUR', '',        '3',  '<i>italic</i>',    'No'],
         ['19', '3', 'Glue',   '250 ml',       'Liquids', '',           'SEK', 'checked', '40', '<u>underline</u>', '<strong>Yes</strong>']];
$currencies= [[['DKK', 'DKK', '@Danish krone'], ['EUR', 'EUR', '@Euro'], ['SEK', 'SEK', '@Swedish krona']], 'width: 70px;'];
htm_Table(body: [
        ['@Id',       '0%',  'hidd', '', ['left'],   'id',    '@The record id - hidden, but posted'],
        ['@No.',      '5%',  'indx', '', ['center'], 'no',    '@indx: the row number - click it'],
        ['@Item',     '12%', 'text', '', ['left'],   'item',  '@text: an editable field', '@Item...'],
        ['@Note',     '14%', 'data', '', ['left'],   'note',  '@data: like text', '@Note...'],
        ['@Group',    '10%', 'show', '', ['left'],   'grp',   '@show: read only'],
        ['@Date',     '13%', 'date', '', ['center'], 'date',  '@date: a date field'],
        ['@Cur.',     '10%', 'ddwn', '', ['center'], 'cur',   '@ddwn: a select - the options in field 9', '', '', $currencies],
        ['@In stock', '7%',  'chck', '', ['center'], 'stock', '@chck: a checkbox - posted as checked or empty'],
        ['@Qty.',     '7%',  'intg', '', ['right'],  'qty',   '@intg: an integer'],
        ['@HTML',     '12%', 'html', '', ['left'],   'html',  '@html: the value as HTML (not posted)'],
        ['@Bold?',    '5%',  'bold', '', ['center'], 'bold',  '@bold: is the text bold (read only)']],
    suff: [['@Del.', '3%', 'rowact', '', ['center'], '@Delete the row (it asks first - Undo brings it back)', 'del']],
    data: $items, crea: '@New item', vhgh: '170px', filt: false);
Type
What it does
Posted
text, data, area, sttu An editable text field yes
show A read only field yes
intg An integer, formatted with the thousands separator yes
date A date field (yyyy-mm-dd) yes
ddwn A select. Field 9: [[[value, label, hint], ...], css] yes
opti A htm_Input() option field (with its own label). Field 9: [[value, label, hint], ...] yes
chck A checkbox. The value posted is checked or empty - for every row yes
bold, ital A read only checkbox: is the text bold / italic no
indx, keyn The value as a link (e.g. the row number) - with modi a click calls rowLookup(). keyn is an old name of indx yes
html, htm0 The value as HTML (htm0: small) no
blnk Nothing is shown no
hidd A hidden column - e.g. the record id yes
calc A calculated number. Field 8: the formula, fn($row) => number - see the example below yes
vars Old: a select with records [-, value, label, attributes] from field 9 (else the list parameter) yes
calc: a column with a number calculated from the other fields of the row. Field 8 is the formula: a function that gets the row as [fkey => value].
Item
{Editable}
Qty.
{Editable}
Price
{Editable}
Disc. %
{Editable}
Total
Quantity x price - discount
Show the codeHide the code
$lines= [['Hammer', '2', '89.50', '10'],
         ['Saw',    '1', '249',   '0']];
htm_Table(body: [['@Item',     '34%', 'text', '',   ['left'],  'item'],
                 ['@Qty.',     '14%', 'text', '',   ['right'], 'qty'],
                 ['@Price',    '18%', 'text', '2d', ['right'], 'price'],
                 ['@Disc. %',  '14%', 'text', '',   ['right'], 'disc'],
                 ['@Total',    '20%', 'calc', '2d', ['right'], 'total', '@Quantity x price - discount', '',
                    fn($r) => toNum($r['qty']) * toNum($r['price']) * (100 - toNum($r['disc'])) / 100]],
          data: $lines, crea: false, filt: false, vhgh: '130px');
Save posts the card form - see the card at the top Remember to save here if you changed anything above, before leaving the window.
Drag to resize the card (or use the arrow keys). Double-click or Home: original sizeColumn view: the column decides the width of the card - only the height can be dragged (down to less than the content). Turn the column view off to change the width.
MOVE: Drag to place this card elsewhere among the cards. Alt + arrow up/down: one place. The order is remembered in this browser.Output formats (field 3) and column style (field 4)TOGGLE: Click icon or card header-text to open / close this card TOGGLE-height: Click icon to toggle viewHeight for this card WIDE: Click to maximize/normalize this card width COLLAPSE: Click to close all cards EXPAND: Click to open all cards
0d
0 decimals
1d
1 decimal
2d
2 decimals
2%
2 decimals and %
>0
Blank when 0 or less
'= '
Always blank
B
Bold #00000 (type html)
R
Red (type html)
L
Blue (type html)
#00042 red text blue text
#00007 stop go
Show the codeHide the code
$numbers= [['1234.5', '1234.5', '1234.5', '12.5', '0', '1234.5', '42', 'red text', 'blue text'],
           ['-7',     '-7',     '-7',     '100',  '3', '-7',     '7',  'stop',     'go']];
htm_Table(body: [
        ['0d',   '10%', 'show', '0d', ['right'],  'f0', '@0 decimals'],
        ['1d',   '10%', 'show', '1d', ['right'],  'f1', '@1 decimal'],
        ['2d',   '12%', 'show', '2d', ['right'],  'f2', '@2 decimals'],
        ['2%',   '12%', 'show', '2%', ['right'],  'fp', '@2 decimals and %'],
        ['>0',   '8%',  'show', '>0', ['right'],  'fz', '@Blank when 0 or less'],
        ["'= '", '8%',  'show', '= ', ['right'],  'fb', '@Always blank'],
        ['B',    '12%', 'html', 'B',  ['center'], 'fB', '@Bold #00000 (type html)'],
        ['R',    '14%', 'html', 'R',  ['center'], 'fR', '@Red (type html)'],
        ['L',    '14%', 'html', 'L',  ['center'], 'fL', '@Blue (type html)']],
    data: $numbers, crea: false, modi: false, filt: false, sort: false, vhgh: '130px');
The numbers use the separators of the program (DecimalSep / ThousandsSep).
[0] align [0] text-align
{Editable}
[1] background [1] cell background
{Editable}
[2] field style [2] style of the text field
{Editable}
[3] marking [3] cell background (row marking)
{Editable}
[4] font-size [4] font-size
{Editable}
Show the codeHide the code
$styled= [['Normal', 'Yellow cell', 'Italic field', 'Marked cell', 'Small text'],
          ['Normal', 'Yellow cell', 'Italic field', 'Marked cell', 'Small text']];
htm_Table(body: [
        ['@[0] align',       '20%', 'text', '', ['right'],                                     'a', '@[0] text-align'],
        ['@[1] background',  '20%', 'text', '', ['left', 'lightyellow'],                       'b', '@[1] cell background'],
        ['@[2] field style', '20%', 'text', '', ['left', '', 'font-style:italic; color:#900;'], 'c', '@[2] style of the text field'],
        ['@[3] marking',     '20%', 'text', '', ['left', '', '', '#d8ecff'],                   'd', '@[3] cell background (row marking)'],
        ['@[4] font-size',   '20%', 'text', '', ['left', '', '', '', '10px'],                  'e', '@[4] font-size']],
    data: $styled, crea: false, filt: false, sort: false, vhgh: '130px');
Drag to resize the card (or use the arrow keys). Double-click or Home: original sizeColumn view: the column decides the width of the card - only the height can be dragged (down to less than the content). Turn the column view off to change the width.
MOVE: Drag to place this card elsewhere among the cards. Alt + arrow up/down: one place. The order is remembered in this browser.Columns before and after the data (pref, suff)TOGGLE: Click icon or card header-text to open / close this card TOGGLE-height: Click icon to toggle viewHeight for this card WIDE: Click to maximize/normalize this card width COLLAPSE: Click to close all cards EXPAND: Click to open all cards
rowact: delete, copy, move and undo in the browser - the new order is posted when you save.
button (label @Delete, @Hide, @Copy, @Rename or @Select): a submit button per row - the form is sent at once, and the server gets e.g. btn_hid_<table>_<row>.
rowact del or button @Delete? rowact removes the row in the browser (the server sees it is missing when you save); button @Delete asks the server to delete it now.
Other suffix types show field 6 as HTML. Suffix columns are shown only with modi:true.
Pick Prefix: the same HTML in every row (name="x" becomes name="i<row>_x") Task The task
{Editable}
Who Who does it
{Editable}
Rows Delete, copy, move and undo in the browserHide A submit button: the server gets btn_hid_<table>_<row> at once and can hide the recordInfo Any HTML
Delete the rowCopy the row (the copy is inserted below it)Move the row upMove the row downUndo the last row change (delete, copy, move)
Delete the rowCopy the row (the copy is inserted below it)Move the row upMove the row downUndo the last row change (delete, copy, move)
Delete the rowCopy the row (the copy is inserted below it)Move the row upMove the row downUndo the last row change (delete, copy, move)
Create an empty row, so you can fill in data in the yellow fields !
Keyboard shortcut: Alt+C
Show the codeHide the code
$tasks= [['31', 'Write the offer',   'Anna'],
         ['32', 'Order materials',   'Bo'],
         ['33', 'Book the delivery', 'Carl']];
htm_Table(
    pref: [['@Pick', '6%', '', '', ['center'], '@Prefix: the same HTML in every row (name="x" becomes name="i&lt;row&gt;_x")',
            '<input type="checkbox" name="pick" value="1" style="box-shadow:none;">']],
    body: [['@Id',   '0%',  'hidd', '', ['left'], 'id'],
           ['@Task', '46%', 'text', '', ['left'], 'task', '@The task'],
           ['@Who',  '20%', 'text', '', ['left'], 'who',  '@Who does it']],
    suff: [['@Rows',   '16%', 'rowact', '', ['center'], '@Delete, copy, move and undo in the browser', 'del copy move undo'],
           ['@Hide',   '6%',  'button', '', ['center'], '@A submit button: the server gets btn_hid_&lt;table&gt;_&lt;row&gt; at once and can hide the record',
            '<ic class="fas fa-eye-slash" style="color:#6d4c41;"></ic>'],
           ['@Info',   '6%',  'text',   '', ['center'], '@Any HTML', '<ic class="fas fa-info-circle" style="color:#1565c0;"></ic>']],
    data: $tasks, crea: '@New task', filt: false, vhgh: '160px');
Save posts the rows in their new order Remember to save here if you changed anything above, before leaving the window.
Drag to resize the card (or use the arrow keys). Double-click or Home: original sizeColumn view: the column decides the width of the card - only the height can be dragged (down to less than the content). Turn the column view off to change the width.
MOVE: Drag to place this card elsewhere among the cards. Alt + arrow up/down: one place. The order is remembered in this browser.Above and below the table (capt, note)TOGGLE: Click icon or card header-text to open / close this card TOGGLE-height: Click icon to toggle viewHeight for this card WIDE: Click to maximize/normalize this card width COLLAPSE: Click to close all cards EXPAND: Click to open all cards

Orders Count:2 orders Customer:    Info: HTML from field 7
Order
Name
{Editable}
Total

note: HTML below the table
Show the codeHide the code
$orders= [['1001', 'Anna', '1250'], ['1002', 'Bo', '980']];
htm_Table(
    capt: [['<b>'.lang('@Orders').'</b>', '',    'show'],
           ['@Count:',                   '',    'rows', '', '', '', '@orders'],
           ['@Customer:',                '25%', 'data', 'cust_filter', 'left', '@A field with a name - it is posted', '@Name...', ''],
           ['@Info:',                    '',    'html', '', '', '', '', '<small>'.lang('@HTML from field 7').'</small>']],
    body: [['@Order', '30%', 'show', '',   ['center'], 'ord'],
           ['@Name',  '40%', 'text', '',   ['left'],   'name'],
           ['@Total', '30%', 'show', '2d', ['right'],  'total']],
    note: '<small>'.lang('@note: HTML below the table').'</small>',
    data: $orders, crea: false, filt: false, vhgh: '130px');
capt types: show (only the text), rows (the number of rows), html (field 7 as HTML), data (a field with the name in field 3 - posted), text / number / date ... (a field without a name - not posted). The fields above are shown only when the table has data.
Remember to save here if you changed anything above, before leaving the window.
Drag to resize the card (or use the arrow keys). Double-click or Home: original sizeColumn view: the column decides the width of the card - only the height can be dragged (down to less than the content). Turn the column view off to change the width.
MOVE: Drag to place this card elsewhere among the cards. Alt + arrow up/down: one place. The order is remembered in this browser.The data: lists or rows with field namesTOGGLE: Click icon or card header-text to open / close this card TOGGLE-height: Click icon to toggle viewHeight for this card WIDE: Click to maximize/normalize this card width COLLAPSE: Click to close all cards EXPAND: Click to open all cards
Each row can be a list (the values in the order of body) or have field names (e.g. a database row) - then the values are placed by the field names, in any order, and a missing field is empty. Both kinds can be mixed, as here.
Id
Name
{Editable}
City
{Editable}
Show the codeHide the code
$rows= [['1', 'Anna', 'Copenhagen'],                                  # A list: the values in the order of body
        ['city' => 'Aarhus', 'id' => '2', 'name' => 'Bo'],            # Field names: any order
        ['name' => 'Carl', 'id' => '3']];                             # Field names: a missing field is empty
htm_Table(body: [['@Id',   '20%', 'show', '', ['center'], 'id'],
                 ['@Name', '40%', 'text', '', ['left'],   'name'],
                 ['@City', '40%', 'text', '', ['left'],   'city']],
          data: $rows, crea: false, filt: false, vhgh: '160px');
Drag to resize the card (or use the arrow keys). Double-click or Home: original sizeColumn view: the column decides the width of the card - only the height can be dragged (down to less than the content). Turn the column view off to change the width.
MOVE: Drag to place this card elsewhere among the cards. Alt + arrow up/down: one place. The order is remembered in this browser.Export to CSV (expo)TOGGLE: Click icon or card header-text to open / close this card TOGGLE-height: Click icon to toggle viewHeight for this card WIDE: Click to maximize/normalize this card width COLLAPSE: Click to close all cards EXPAND: Click to open all cards
No.
Description
{Editable}
Account
{Editable}
%-rate
{Editable}
Show the codeHide the code
$vat= [['1', lang('@Input VAT'),  '66200', '25,00'],
       ['2', lang('@Output VAT'), '66201', '25,00'],
       ['3', '=SUM(A1:A9)',       '66202', '-12,50']];               # A formula is written with a leading apostrophe
htm_Table(body: [['@No.',         '10%', 'show', '', ['center'], 'vat_no'],
                 ['@Description', '50%', 'text', '', ['left'],   'vat_desc'],
                 ['@Account',     '20%', 'text', '', ['center'], 'vat_acc'],
                 ['@%-rate',      '20%', 'text', '', ['right'],  'vat_rate']],
          data: $vat, crea: false, filt: false, vhgh: '160px', expo: 'tableexport.csv');
Download the table as CSV (expo:)Text starting with = + - @ is written with a leading apostrophe, so Excel does not run it as a formula
Drag to resize the card (or use the arrow keys). Double-click or Home: original sizeColumn view: the column decides the width of the card - only the height can be dragged (down to less than the content). Turn the column view off to change the width.
MOVE: Drag to place this card elsewhere among the cards. Alt + arrow up/down: one place. The order is remembered in this browser.All parameters of htm_Table()TOGGLE: Click icon or card header-text to open / close this card TOGGLE-height: Click icon to toggle viewHeight for this card WIDE: Click to maximize/normalize this card width COLLAPSE: Click to close all cards EXPAND: Click to open all cards
Read from the library itself: the name, the default value and the description.
Parameter
Default
Type
Description
capt [] array Fields above the table: [0:labl, 1:wdth, 2:type, 3:name, 4:algn, 5:hint, 6:plho, 7:valu]
type: show (only the text) / rows (the number of rows + 6) / html (7 as HTML) / data (a field with name 3 - posted)
/ text, number, date ... (a field without name - not posted). Shown only when the table has data.
pref [] array Columns before the data: [0:labl, 1:wdth, 2:-, 3:-, 4:[algn], 5:hint, 6:html]
6 is the same HTML in every row; name="x" becomes name="i<row>_x"
body [] array The data columns: [0:labl, 1:wdth, 2:type, 3:frmt, 4:[style], 5:fkey, 6:hint, 7:plho, 8:calc, 9:[list, css]]
2 type: text data area sttu (field) / show (read only) / intg (integer) / date / ddwn (select, 9) / opti (htm_Input option field, 9)
chck (checkbox) / bold ital (read only: is the text bold/italic) / indx keyn (the value as a link, clickable)
html htm0 (the value as HTML) / blnk (nothing) / hidd (hidden, posted) / calc (a number from field 8) / vars (old select)
3 frmt: 0d 1d 2d (decimals) / 2% (2 decimals + %) / >0 (blank when 0 or less) / '= ' (always blank) / B R L (bold #00000, red, blue - type html)
4 style: [0:text-align, 1:cell background, 2:field style (text fields), 3:cell background (row marking), 4:font-size]
5 fkey: the field name - posted as fkey[] (one value per row, in the order of the rows)
8 calc: fn($row) => number - $row is [fkey => value], e.g. fn($r) => toNum($r['qty']) * toNum($r['price'])
9 list: [[[value, label, hint], ...], 'css of the select'] (ddwn/opti)
suff [] array Columns after the data (only with modi): [0:labl, 1:wdth, 2:type, 3:-, 4:[algn], 5:hint, 6:valu]
type rowact: row actions in the browser, 6 = 'del copy move undo' (any of them)
type button: a submit button named btn_<del|hid|cpy|ren|sel>_<table>_<row> - by 0: @Delete @Hide @Copy @Rename @Select, 6 = its icon
else: 6 is shown as HTML (an "open-modal_N" in it opens one dialog per row)
note '' string HTML below the table ('' with filt: a hint about the filter)
list ["",""] array The row rules of customRules.inc.php, e.g. ['KONTOPLAN'] - and the options of 'vars' columns
data (&) [] array The rows (by reference - give a variable): [[v0, v1, ...], ...] in the order of body, or [[fkey => value, ...], ...]
wdth '98%' string The width of the table
vhgh '400px' string The height of the scrolling window with the rows (the header stays)
styl '' string Style for the span that holds the table
filt true bool A filter field below each header
sort true bool Sort by clicking a header (SHIFT+click: by more columns)
crea true bool A button that adds an empty row - a string is the label of the button
modi true bool The fields can be changed, and the suffix columns are shown
from __FILE__ string Where the table is made (__FILE__ / __FUNCTION__) - shown by indx/keyn clicks
expo '' string Also write the data to this CSV file (UTF-8, Excel-safe)
rtrn false bool Return the HTML instead of echoing it
htm_Table() uses Mottie Tablesorter (sticky header, sort, filter, zebra). mottie.github.io/tablesorter
Without jQuery: htm_TableTools() gives search and sort for any table.
Drag to resize the card (or use the arrow keys). Double-click or Home: original sizeColumn view: the column decides the width of the card - only the height can be dragged (down to less than the content). Turn the column view off to change the width.