needtable¶
Added in version 0.2.0.
needtable generates a table, based on the result of given filters.
Example 1
.. needtable:: Example table
:tags: main_example
:style: table
No needs passed the filters
We use the argument of a needtable as caption for the table.
Options¶
Note
needtable supports the full filtering possibilities of Sphinx-Needs. Please see Filtering needs for more information.
Some further options are accepted only for ubCode compatibility, and are otherwise ignored.
columns¶
A comma/semicolon separated string used to define the position of specific columns. For instance:
.. needtable::
:columns: id;title;tags
This will show the columns id, title and tags in the order given.
Example 2
.. needtable::
:columns: id;title;tags
ID |
Title |
Tags |
|---|---|---|
Analysis issue |
||
Barks for support |
||
Find & Report bug |
gantt_example |
|
Analyse bug |
gantt_example |
|
Create example |
gantt_ex_duration |
|
Create example |
gantt_ex_completion |
|
Create example |
gantt_ex_ends_with |
|
Create example |
gantt_ex_starts_after |
|
Create example |
gantt_ex_starts_with |
|
Deploy release |
gantt_example |
|
Informs reporter |
||
Creates issue |
||
Read example |
gantt_ex_duration |
|
Read example |
gantt_ex_completion |
|
Read example |
gantt_ex_ends_with |
|
Read example |
gantt_ex_starts_after |
|
Read example |
gantt_ex_starts_with |
|
Add solution to release plan |
gantt_example |
|
Reviews solution |
||
Provides solution |
||
Test release |
gantt_example |
|
Create solution ticket |
gantt_example |
|
Work on solution ticket |
gantt_example |
|
Understand example |
gantt_ex_starts_with |
|
Basic need example |
||
Input A |
||
Input B |
||
Input C |
||
Component X |
||
Component Y |
||
Variant A or B |
||
NeedUml example need 2 |
needuml |
|
COMP_T_001 |
||
COMP_T_002 |
||
COMP_T_003 |
||
Component X |
||
Z |
||
Requirement 1 |
||
Requirement 2 |
||
Test spec |
||
Test spec 2 |
||
copy-example |
tag_1; tag_2; tag_3 |
|
copy-example implementation |
||
test of specification and requirement |
tag_1; tag_2; tag_3 |
|
test of current_need value |
||
Second Requirement Need |
||
Nested Need without delete option |
nested-del-need |
|
my test requirement |
test; open |
|
A specification with a picture |
example |
|
A requirement summarised on a card |
example |
|
CLEAN layout |
a; b; c; example |
|
CLEAN_L layout |
a; b; c; example |
|
CLEAN_LP layout |
a; b; c; example |
|
CLEAN_R layout |
a; b; c; example |
|
CLEAN_RP layout |
a; b; c; example |
|
COMPLETE layout |
a; b; c; example |
|
DEBUG layout |
a; b; c; example |
|
FOCUS layout |
a; b; c; example |
|
FOCUS_F layout |
a; b; c; example |
|
FOCUS_L layout |
a; b; c; example |
|
FOCUS_R layout |
a; b; c; example |
|
A normal requirement |
||
A more complex and highlighted requirement |
awesome; nice; great; example |
|
A focused requirement |
example |
|
A custom requirement with picture |
example |
|
A requirement with a permalink |
example |
|
Implemented spec |
ex_row_color |
|
Not implemented spec |
ex_row_color |
|
Spec under progress |
ex_row_color |
|
Blue background |
example |
|
Blue bar |
example |
|
Blue border |
example |
|
Clean style |
example |
|
Discreet background |
example |
|
Discreet border |
example |
|
Discreet view |
example |
|
Green background |
example |
|
Green bar |
example |
|
Green border |
example |
|
Orange bar |
example |
|
Red background |
example |
|
Red bar |
example |
|
Red border |
example |
|
Yellow background |
example |
|
Yellow bar |
example |
|
Yellow border |
example |
|
Yellow background + Red border |
example |
|
Error when building multiple latex documents |
latex; pkg: sphinx-needs |
|
Failed to sphinx-build HTML docs for 1.3.0 tag? |
||
A node can only be in one page, else it will be cut when generate latexpdf |
bug; help wanted; no_fix |
|
Fails to build PDF when 'req' directive contains nested directives |
pkg: sphinx-needs |
|
I cannot build the examples from a clean environment |
||
NotImplementedError: <class 'sphinx.writers.latex.LaTeXTranslator'> departing unknown node type: NeedRef |
||
Duplicate labels in `.tex` output |
pkg: sphinx-needs |
|
Issue with sphinxneeds directives during latexpdf build |
pkg: sphinx-needs |
|
Use needs_string_links |
||
Feature A |
||
Feature B |
B |
|
Requirement 1 |
A; fast |
|
Requirement 2 |
A; big |
|
needextend Example 1 |
tag_1; tag_2; new_tag |
|
needextend Example 2 |
extend_example; other |
|
needextend Example 3 |
||
needextend Example 4 |
||
needextend Example 5 |
||
needextend Example 6 |
||
needextend Example 7 |
applied_first; applied_second |
|
My requirement |
||
Test of requirements |
||
A feature |
||
Level 1 |
||
NeedUml example need |
needuml |
|
User needs to login |
user; login |
|
My test spec |
example |
|
Implementation for specification |
||
Build awesome car |
||
Test needuml save |
||
Interface A |
||
Need with jinja_content enabled |
||
First Req Need |
||
Nested Spec Need |
user; login |
|
First Spec Need |
||
My layout requirement 1 |
layout_example |
|
My layout requirement 2 |
layout_example |
|
My layout requirement 3 |
layout_example |
|
Open requirement |
||
→ open part |
||
Another open requirement |
||
Collector of open needs |
||
Collector of requirements and their parts |
||
login |
||
logout |
||
Session tests |
||
Feature 1 |
||
Feature 2 |
||
Feature 3 |
||
Requirement which shall get also need-parts |
||
→ The first need-part |
||
→ ANOTHER need-part |
||
Bug solved |
gantt_example |
|
Solution ticket closed |
gantt_example |
|
Car must be awesome |
car |
|
→ A top speed of 300 km/h |
car |
|
→ An acceleration of 200 m/s² or much much more |
car |
|
→ a turbo button |
car |
|
Another Need example on level 1 with a given ID |
||
Login user |
||
Provide login screen |
||
Create password hash |
||
Recalculate hash and compare |
||
Specification of a requirement |
||
Set admin e-mail to admin@mycompany.com |
||
Requirement B |
B; filter_example |
|
Link example Source |
||
Requirement A |
A; filter_example |
|
Collapse is set to False |
collapse; example |
|
Result 4 |
||
Group big short |
||
Level 1 need and more |
||
Level 1 need with rst |
||
This is a requirement with a very long title that will need to be |
||
critical |
||
Result 2 |
||
Collapse is set to True |
collapse; example |
|
test requirement |
||
The first sentence will be the title |
||
Result 3 |
||
This will be my title |
||
Level 2 |
||
Level 1 need with newlines |
||
Need example on level 1 |
||
My first requirement |
requirement; test; awesome |
|
Result 1 |
||
Requirement arch |
||
Req Arch second |
||
Req Arch third |
||
Req Arch four |
||
A requirement |
flow_example |
|
Link example Target |
||
Sliced Bread |
||
Butter on Bread |
||
Specification B |
B; filter_example |
|
And a complex sub-need on level 2 with an image-directive |
||
result 1: Positive check |
||
result 2: Negative check |
||
Another Sub-Need on level 2 |
||
And a spec need |
||
result 3: Positive check thanks of used filter |
||
result 5: Two checks and a joint status |
||
result 4: Positive check thanks of one_hit option |
||
Sub-Need on level 2 with status option set |
||
Level 3 |
||
Specification A |
A; filter_example |
|
Interfaces |
||
A specification |
flow_example |
|
→ A testable part of the specification |
flow_example |
|
→ Another testable part of the specification |
flow_example |
|
Another specification |
flow_example |
|
A child specification |
flow_example |
|
My styled requirement |
style_example |
|
Another styled requirement |
style_example |
|
Green is my color |
style_example |
|
Yellow and blue border |
||
My automatically styled requirement |
style_example |
|
My automatically styled requirement |
style_example |
|
Order service |
styles_example |
|
Order store |
styles_example |
|
Do this |
||
Do that |
||
Do too much |
||
System RocketScience |
||
Unit test 1 |
tutorial; tutorial_tests |
|
Unit test 2 |
tutorial; tutorial_tests |
|
Unit test 3 |
tutorial; tutorial_tests |
|
Unit test 4 |
tutorial; tutorial_tests |
|
Level 4 |
||
Test 1 |
filter_example |
|
Test for XY |
test; user_interface; python27 |
|
Our new car |
tutorial |
|
Connectivity and Entertainment |
tutorial |
|
Implement distant detection |
tutorial |
|
Sub-Need on level 3 |
||
Implement RADAR system |
tutorial |
|
Safety Features |
tutorial |
|
Test need with need parts |
test_table |
|
→ Part 1 of requirement |
test_table |
|
→ Part 2 of requirement |
test_table |
|
→ Part 3 of requirement |
test_table |
|
Specifies part 1 |
test_table |
|
Specifies part 2 |
test_table |
|
My specification |
example; template |
|
My specification |
example; template |
|
My specification |
example; template |
|
test a requirement |
||
Test Arch |
||
A test case |
flow_example |
|
test me |
||
Mr. A |
||
Ms. B |
||
Expert C |
||
Office Dog |
||
Variant options |
variants; support |
|
My requirement with custom options |
You can set all options of a need (incl. needs_fields) as a column.
This also includes internal options like docname (Use :layout: debug on a need for a complete list)
If you set :columns:, the current table will not use the value of config parameter needs_table_columns.
Tables with a lot of columns will get a horizontal scrollbar in HTML output.
Interactive style
Example 3
.. needtable::
:tags: test
:columns: id;title;tags;status;docname;lineno,is_external,is_need;is_part;content
ID |
Title |
Tags |
Status |
Docname |
Lineno |
Is External |
Is Need |
Is Part |
Content |
|---|---|---|---|---|---|---|---|---|---|
my test requirement |
test; open |
open |
dynamic_functions |
71 |
False |
True |
False |
This need has id :ndf:`copy("id")` and status :ndf:`copy("status")`. |
|
My first requirement |
requirement; test; awesome |
open |
filter |
903 |
False |
True |
False |
This is my **first** requirement!! .. note:: You can use any rst code inside it :) |
|
Test for XY |
test; user_interface; python27 |
implemented |
filter |
923 |
False |
True |
False |
This test checks :need:`IMPL_01` for :need:`OWN_ID_123` inside a Python 2.7 environment. |
Normal style
Example 4
.. needtable::
:tags: test
:style: table
:columns: id;title;tags;status;docname;lineno,is_external,is_need;is_part;content
ID |
Title |
Tags |
Status |
Docname |
Lineno |
Is External |
Is Need |
Is Part |
Content |
|---|---|---|---|---|---|---|---|---|---|
my test requirement |
test; open |
open |
dynamic_functions |
71 |
False |
True |
False |
This need has id :ndf:`copy("id")` and status :ndf:`copy("status")`. |
|
My first requirement |
requirement; test; awesome |
open |
filter |
903 |
False |
True |
False |
This is my **first** requirement!! .. note:: You can use any rst code inside it :) |
|
Test for XY |
test; user_interface; python27 |
implemented |
filter |
923 |
False |
True |
False |
This test checks :need:`IMPL_01` for :need:`OWN_ID_123` inside a Python 2.7 environment. |
colwidths¶
Added in version 0.7.4.
A comma separated list of lengths or percentages used to define the width of each column.
It has the same meaning as the width options of
listtable directive.
Example 5
.. needtable::
:tags: test
:columns: id,title,status
:colwidths: 50,40,10
:style: table
Custom column titles¶
You can customize each column title by following this syntax for its definition: OPTION as "My custom title".
The characters , or ; are not allowed.
show_filters¶
If set, we add the used filter above the table:
style¶
Allows you to set a specific style for the current table.
Supported values are:
tableA plain Sphinx table. The rows are exactly what the sort option produced, and nothing is added on top of them.
datatablesThe interactive table, and the default. It is the same table, enhanced in the browser by a small script that ships with Sphinx-Needs: the reader can sort a column, search the whole table, page through it and choose how many rows a page holds, switch columns off, copy the table to the clipboard and download it as CSV.
The enhancement is in place: every row and cell stays the element Sphinx-Needs rendered, so style_row classes, the
needs_<column>cell classes and the links inside cells all survive sorting and searching, and a reader with JavaScript switched off still gets the whole table.The count it shows – Showing 1-10 of 42 – counts needs, not rows: a need and its parts are one entry, so that a page never splits a need from its parts. The DataTables style counted rows, so a table with
:show_parts:reports a smaller total than DataTables did.What it deliberately does not do: export to Excel or PDF (the CSV it writes opens in Excel, and the browser’s own print command prints the page), and let the reader drag columns into a different order. Both were features of the DataTables package Sphinx-Needs bundled before this change.
Overrides config parameter needs_table_style if set.
Show example
Example 8
.. needtable::
:style: table
.. needtable::
:style: datatables
ID |
Title |
Status |
Outgoing |
|---|---|---|---|
Analysis issue |
|||
Barks for support |
|||
Find & Report bug |
|||
Analyse bug |
|||
Create example |
|||
Create example |
|||
Create example |
|||
Create example |
|||
Create example |
|||
Deploy release |
|||
Informs reporter |
|||
Creates issue |
|||
Read example |
|||
Read example |
|||
Read example |
|||
Read example |
|||
Read example |
|||
Add solution to release plan |
|||
Reviews solution |
|||
Provides solution |
|||
Test release |
|||
Create solution ticket |
|||
Work on solution ticket |
|||
Understand example |
|||
Basic need example |
|||
Input A |
in progress |
||
Input B |
in progress |
||
Input C |
closed |
||
Component X |
|||
Component Y |
|||
Variant A or B |
|||
NeedUml example need 2 |
draft |
||
COMP_T_001 |
|||
COMP_T_002 |
|||
COMP_T_003 |
|||
Component X |
|||
Z |
|||
Requirement 1 |
|||
Requirement 2 |
|||
Test spec |
|||
Test spec 2 |
|||
copy-example |
open |
||
copy-example implementation |
open |
||
test of specification and requirement |
|||
test of current_need value |
|||
Second Requirement Need |
|||
Nested Need without delete option |
|||
my test requirement |
open |
||
A specification with a picture |
open |
||
A requirement summarised on a card |
open |
||
CLEAN layout |
open |
||
CLEAN_L layout |
open |
||
CLEAN_LP layout |
open |
||
CLEAN_R layout |
open |
||
CLEAN_RP layout |
open |
||
COMPLETE layout |
open |
||
DEBUG layout |
open |
||
FOCUS layout |
open |
||
FOCUS_F layout |
open |
||
FOCUS_L layout |
open |
||
FOCUS_R layout |
open |
||
A normal requirement |
open |
||
A more complex and highlighted requirement |
open |
||
A focused requirement |
open |
||
A custom requirement with picture |
open |
||
A requirement with a permalink |
open |
||
Implemented spec |
implemented |
||
Not implemented spec |
open |
||
Spec under progress |
in progress |
||
Blue background |
|||
Blue bar |
|||
Blue border |
|||
Clean style |
|||
Discreet background |
|||
Discreet border |
|||
Discreet view |
|||
Green background |
|||
Green bar |
|||
Green border |
|||
Orange bar |
|||
Red background |
|||
Red bar |
|||
Red border |
|||
Yellow background |
|||
Yellow bar |
|||
Yellow border |
|||
Yellow background + Red border |
|||
Error when building multiple latex documents |
open |
||
Failed to sphinx-build HTML docs for 1.3.0 tag? |
closed |
||
A node can only be in one page, else it will be cut when generate latexpdf |
closed |
||
Fails to build PDF when 'req' directive contains nested directives |
closed |
||
I cannot build the examples from a clean environment |
closed |
||
NotImplementedError: <class 'sphinx.writers.latex.LaTeXTranslator'> departing unknown node type: NeedRef |
closed |
||
Duplicate labels in `.tex` output |
open |
||
Issue with sphinxneeds directives during latexpdf build |
closed |
||
Use needs_string_links |
|||
Feature A |
|||
Feature B |
done |
||
Requirement 1 |
|||
Requirement 2 |
|||
needextend Example 1 |
open |
||
needextend Example 2 |
open |
||
needextend Example 3 |
open |
||
needextend Example 4 |
open |
||
needextend Example 5 |
open |
||
needextend Example 6 |
open |
||
needextend Example 7 |
late |
||
My requirement |
|||
Test of requirements |
|||
A feature |
|||
Level 1 |
|||
NeedUml example need |
draft |
||
User needs to login |
open |
||
My test spec |
open |
||
Implementation for specification |
|||
Build awesome car |
|||
Test needuml save |
|||
Interface A |
|||
Need with jinja_content enabled |
|||
First Req Need |
|||
Nested Spec Need |
open |
||
First Spec Need |
open |
||
My layout requirement 1 |
|||
My layout requirement 2 |
|||
My layout requirement 3 |
|||
Open requirement |
open |
||
→ open part |
open |
||
Another open requirement |
open |
||
Collector of open needs |
open |
||
Collector of requirements and their parts |
|||
login |
|||
logout |
|||
Session tests |
|||
Feature 1 |
|||
Feature 2 |
|||
Feature 3 |
|||
Requirement which shall get also need-parts |
|||
→ The first need-part |
|||
→ ANOTHER need-part |
|||
Bug solved |
|||
Solution ticket closed |
|||
Car must be awesome |
open |
||
→ A top speed of 300 km/h |
open |
||
→ An acceleration of 200 m/s² or much much more |
open |
||
→ a turbo button |
open |
||
Another Need example on level 1 with a given ID |
|||
Login user |
|||
Provide login screen |
|||
Create password hash |
|||
Recalculate hash and compare |
|||
Specification of a requirement |
|||
Set admin e-mail to admin@mycompany.com |
|||
Requirement B |
closed |
||
Link example Source |
|||
Requirement A |
open |
||
Collapse is set to False |
|||
Result 4 |
|||
Group big short |
|||
Level 1 need and more |
|||
Level 1 need with rst |
|||
This is a requirement with a very long title that will need to be |
|||
Result 2 |
|||
Collapse is set to True |
|||
test requirement |
|||
The first sentence will be the title |
|||
Result 3 |
|||
This will be my title |
|||
Level 2 |
|||
Level 1 need with newlines |
|||
Need example on level 1 |
|||
My first requirement |
open |
||
Result 1 |
|||
Requirement arch |
|||
Req Arch second |
|||
Req Arch third |
|||
Req Arch four |
draft |
||
A requirement |
|||
Link example Target |
|||
Sliced Bread |
open |
||
Butter on Bread |
|||
Specification B |
open |
||
And a complex sub-need on level 2 with an image-directive |
|||
result 1: Positive check |
progress |
||
result 2: Negative check |
|||
Another Sub-Need on level 2 |
|||
And a spec need |
|||
result 3: Positive check thanks of used filter |
progress |
||
result 5: Two checks and a joint status |
progress closed |
||
result 4: Positive check thanks of one_hit option |
progress |
||
Sub-Need on level 2 with status option set |
open |
||
Level 3 |
|||
Specification A |
closed |
||
Interfaces |
open |
||
A specification |
|||
→ A testable part of the specification |
|||
→ Another testable part of the specification |
|||
Another specification |
|||
A child specification |
|||
My styled requirement |
|||
Another styled requirement |
|||
Green is my color |
|||
Yellow and blue border |
|||
My automatically styled requirement |
implemented |
||
My automatically styled requirement |
open |
||
Order service |
open |
||
Order store |
done |
||
Do this |
|||
Do that |
|||
Do too much |
|||
System RocketScience |
|||
Unit test 1 |
closed |
||
Unit test 2 |
in progress |
||
Unit test 3 |
open |
||
Unit test 4 |
open |
||
Level 4 |
|||
Test 1 |
|||
Test for XY |
implemented |
||
Our new car |
|||
Connectivity and Entertainment |
|||
Implement distant detection |
|||
Sub-Need on level 3 |
|||
Implement RADAR system |
|||
Safety Features |
|||
Test need with need parts |
|||
→ Part 1 of requirement |
|||
→ Part 2 of requirement |
|||
→ Part 3 of requirement |
|||
Specifies part 1 |
|||
Specifies part 2 |
|||
My specification |
|||
My specification |
|||
My specification |
open |
||
test a requirement |
|||
Test Arch |
|||
A test case |
|||
test me |
|||
Mr. A |
|||
Ms. B |
|||
Expert C |
|||
Office Dog |
|||
Variant options |
disabled |
||
My requirement with custom options |
open |
ID |
Title |
Status |
Outgoing |
|---|---|---|---|
Analysis issue |
|||
Barks for support |
|||
Find & Report bug |
|||
Analyse bug |
|||
Create example |
|||
Create example |
|||
Create example |
|||
Create example |
|||
Create example |
|||
Deploy release |
|||
Informs reporter |
|||
Creates issue |
|||
Read example |
|||
Read example |
|||
Read example |
|||
Read example |
|||
Read example |
|||
Add solution to release plan |
|||
Reviews solution |
|||
Provides solution |
|||
Test release |
|||
Create solution ticket |
|||
Work on solution ticket |
|||
Understand example |
|||
Basic need example |
|||
Input A |
in progress |
||
Input B |
in progress |
||
Input C |
closed |
||
Component X |
|||
Component Y |
|||
Variant A or B |
|||
NeedUml example need 2 |
draft |
||
COMP_T_001 |
|||
COMP_T_002 |
|||
COMP_T_003 |
|||
Component X |
|||
Z |
|||
Requirement 1 |
|||
Requirement 2 |
|||
Test spec |
|||
Test spec 2 |
|||
copy-example |
open |
||
copy-example implementation |
open |
||
test of specification and requirement |
|||
test of current_need value |
|||
Second Requirement Need |
|||
Nested Need without delete option |
|||
my test requirement |
open |
||
A specification with a picture |
open |
||
A requirement summarised on a card |
open |
||
CLEAN layout |
open |
||
CLEAN_L layout |
open |
||
CLEAN_LP layout |
open |
||
CLEAN_R layout |
open |
||
CLEAN_RP layout |
open |
||
COMPLETE layout |
open |
||
DEBUG layout |
open |
||
FOCUS layout |
open |
||
FOCUS_F layout |
open |
||
FOCUS_L layout |
open |
||
FOCUS_R layout |
open |
||
A normal requirement |
open |
||
A more complex and highlighted requirement |
open |
||
A focused requirement |
open |
||
A custom requirement with picture |
open |
||
A requirement with a permalink |
open |
||
Implemented spec |
implemented |
||
Not implemented spec |
open |
||
Spec under progress |
in progress |
||
Blue background |
|||
Blue bar |
|||
Blue border |
|||
Clean style |
|||
Discreet background |
|||
Discreet border |
|||
Discreet view |
|||
Green background |
|||
Green bar |
|||
Green border |
|||
Orange bar |
|||
Red background |
|||
Red bar |
|||
Red border |
|||
Yellow background |
|||
Yellow bar |
|||
Yellow border |
|||
Yellow background + Red border |
|||
Error when building multiple latex documents |
open |
||
Failed to sphinx-build HTML docs for 1.3.0 tag? |
closed |
||
A node can only be in one page, else it will be cut when generate latexpdf |
closed |
||
Fails to build PDF when 'req' directive contains nested directives |
closed |
||
I cannot build the examples from a clean environment |
closed |
||
NotImplementedError: <class 'sphinx.writers.latex.LaTeXTranslator'> departing unknown node type: NeedRef |
closed |
||
Duplicate labels in `.tex` output |
open |
||
Issue with sphinxneeds directives during latexpdf build |
closed |
||
Use needs_string_links |
|||
Feature A |
|||
Feature B |
done |
||
Requirement 1 |
|||
Requirement 2 |
|||
needextend Example 1 |
open |
||
needextend Example 2 |
open |
||
needextend Example 3 |
open |
||
needextend Example 4 |
open |
||
needextend Example 5 |
open |
||
needextend Example 6 |
open |
||
needextend Example 7 |
late |
||
My requirement |
|||
Test of requirements |
|||
A feature |
|||
Level 1 |
|||
NeedUml example need |
draft |
||
User needs to login |
open |
||
My test spec |
open |
||
Implementation for specification |
|||
Build awesome car |
|||
Test needuml save |
|||
Interface A |
|||
Need with jinja_content enabled |
|||
First Req Need |
|||
Nested Spec Need |
open |
||
First Spec Need |
open |
||
My layout requirement 1 |
|||
My layout requirement 2 |
|||
My layout requirement 3 |
|||
Open requirement |
open |
||
→ open part |
open |
||
Another open requirement |
open |
||
Collector of open needs |
open |
||
Collector of requirements and their parts |
|||
login |
|||
logout |
|||
Session tests |
|||
Feature 1 |
|||
Feature 2 |
|||
Feature 3 |
|||
Requirement which shall get also need-parts |
|||
→ The first need-part |
|||
→ ANOTHER need-part |
|||
Bug solved |
|||
Solution ticket closed |
|||
Car must be awesome |
open |
||
→ A top speed of 300 km/h |
open |
||
→ An acceleration of 200 m/s² or much much more |
open |
||
→ a turbo button |
open |
||
Another Need example on level 1 with a given ID |
|||
Login user |
|||
Provide login screen |
|||
Create password hash |
|||
Recalculate hash and compare |
|||
Specification of a requirement |
|||
Set admin e-mail to admin@mycompany.com |
|||
Requirement B |
closed |
||
Link example Source |
|||
Requirement A |
open |
||
Collapse is set to False |
|||
Result 4 |
|||
Group big short |
|||
Level 1 need and more |
|||
Level 1 need with rst |
|||
This is a requirement with a very long title that will need to be |
|||
Result 2 |
|||
Collapse is set to True |
|||
test requirement |
|||
The first sentence will be the title |
|||
Result 3 |
|||
This will be my title |
|||
Level 2 |
|||
Level 1 need with newlines |
|||
Need example on level 1 |
|||
My first requirement |
open |
||
Result 1 |
|||
Requirement arch |
|||
Req Arch second |
|||
Req Arch third |
|||
Req Arch four |
draft |
||
A requirement |
|||
Link example Target |
|||
Sliced Bread |
open |
||
Butter on Bread |
|||
Specification B |
open |
||
And a complex sub-need on level 2 with an image-directive |
|||
result 1: Positive check |
progress |
||
result 2: Negative check |
|||
Another Sub-Need on level 2 |
|||
And a spec need |
|||
result 3: Positive check thanks of used filter |
progress |
||
result 5: Two checks and a joint status |
progress closed |
||
result 4: Positive check thanks of one_hit option |
progress |
||
Sub-Need on level 2 with status option set |
open |
||
Level 3 |
|||
Specification A |
closed |
||
Interfaces |
open |
||
A specification |
|||
→ A testable part of the specification |
|||
→ Another testable part of the specification |
|||
Another specification |
|||
A child specification |
|||
My styled requirement |
|||
Another styled requirement |
|||
Green is my color |
|||
Yellow and blue border |
|||
My automatically styled requirement |
implemented |
||
My automatically styled requirement |
open |
||
Order service |
open |
||
Order store |
done |
||
Do this |
|||
Do that |
|||
Do too much |
|||
System RocketScience |
|||
Unit test 1 |
closed |
||
Unit test 2 |
in progress |
||
Unit test 3 |
open |
||
Unit test 4 |
open |
||
Level 4 |
|||
Test 1 |
|||
Test for XY |
implemented |
||
Our new car |
|||
Connectivity and Entertainment |
|||
Implement distant detection |
|||
Sub-Need on level 3 |
|||
Implement RADAR system |
|||
Safety Features |
|||
Test need with need parts |
|||
→ Part 1 of requirement |
|||
→ Part 2 of requirement |
|||
→ Part 3 of requirement |
|||
Specifies part 1 |
|||
Specifies part 2 |
|||
My specification |
|||
My specification |
|||
My specification |
open |
||
test a requirement |
|||
Test Arch |
|||
A test case |
|||
test me |
|||
Mr. A |
|||
Ms. B |
|||
Expert C |
|||
Office Dog |
|||
Variant options |
disabled |
||
My requirement with custom options |
open |
show_parts¶
Added in version 0.3.6.
Adds an extra table row for each need_part / np found inside a filtered need.
It adds the part rows directly under the related need’s row, and their id and title get a prefix. Each part is listed once: a part the filter matches is listed under its need when its need is a row, and has a row of its own only when its need is not one.
To change the prefix please read needs_part_prefix.
Example 9
.. needtable::
:tags: test_table
:filter: is_need
:show_parts:
:columns: id;title;outgoing;incoming
:style: table
ID |
Title |
Outgoing |
Incoming |
|---|---|---|---|
Test need with need parts |
|||
→ Part 1 of requirement |
|||
→ Part 2 of requirement |
|||
→ Part 3 of requirement |
|||
Specifies part 1 |
|||
Specifies part 2 |
Show above example’s configuration
Example 10
.. req:: Test need with need parts
:id: table_001
:tags: test_table
:np:`(1) Part 1 of requirement`.
:np:`(2) Part 2 of requirement`.
:np:`(3) Part 3 of requirement`.
.. spec:: Specifies part 1
:id: table_002
:tags: test_table
:links: table_001.1
.. spec:: Specifies part 2
:id: table_003
:tags: test_table
:links: table_001.2
style_row¶
Added in version 0.4.1.
You can use the style_row option to set a specific class-attribute for the table-row representation and use CSS to select the class-attribute
Also, you can set specific layout for the row.
Example 11
.. needtable::
:tags: ex_row_color
:style_row: needs_blue_border
Row style based on specific need value¶
You can use Dynamic functions to derive the value for style_row based on a specific value of the
documented need in the row.
Example 12
.. needtable::
:tags: ex_row_color
:columns: id, title, status
:style_row: needs_[[copy("status")]]
In this example we set style_row to needs_[[copy("status")]], so the status of each need will be
part of the row style.
Note
If style_row contains whitespaces, they get automatically replaced by _ to get a valid css class name.
So a copied status value like in progress will become in_progress.
Show used configuration
needtable
.. needtable::
:tags: ex_row_color
:columns: id, title, status
:style_row: needs_[[copy("status")]]
needs as input
inside a provided css file
tr.needs_implemented {
background-color: palegreen !important;
}
tr.needs_open {
background-color: palevioletred !important;
}
tr.needs_in_progress {
background-color: palegoldenrod !important;
}
/* This sets values for the status column */
tr.needs_in_progress td.needs_status p {
background-color: #1b6082;
padding: 3px 5px;
text-align: center;
border-radius: 10px;
border: 1px solid #212174;
color: #ffffff;
}
sort¶
Added in version 0.4.3.
Option to sort the filtered-results based on a key.
The sort-value must be compatible with the options supported by the Filter string.
A key that is not a field of the needs is reported as a needs.filter warning,
and the rows are left in the order the filter returned them.
By default, we use id_complete if we don’t set a sort option.
A need whose value is unset (None) comes first, whatever the field’s type,
as one with an empty string does.
This is the case for every need of a type that does not declare a field declared on need types alone
(see needs_types).
The other values are grouped, so that values of different types are never compared:
booleans, then numbers, then text.
Text is compared without regard to case; a list is compared as its values joined with ", ",
and any other value as its text.
Needs with equal values are ordered by id.
Changed in version 9.1.0: An unset value comes first, and equal values are ordered by id.
Before, sorting by a field some needs leave unset stopped the build
('<' not supported between instances of 'NoneType' and 'int'), as did an unknown key;
a list was compared item by item, with regard to case;
and equal values kept the needs’ own order, which could differ between a fresh and an incremental build.
Example 13
.. needtable::
:tags: ex_row_color
:style: table
In this case, we set the sort option to status. So EX_ROW_3 is above of EX_ROW_2.
Example 14
.. needtable::
:tags: ex_row_color
:style: table
:sort: status
Show used configuration
.. needtable::
:tags: ex_row_color
:style: table
.. needtable::
:tags: ex_row_color
:style: table
:sort: status
Note
:sort: decides the order of the rows in both styles.
With style datatables it is the order the reader first
sees, and the one a third click on a column header goes back to; the two clicks in
between sort that column ascending and descending.
Changed in version 9.0.0: Before this change the bundled DataTables package re-sorted every table by its first
column as soon as the page loaded, so :sort: was only visible with :style: table.
Note
When the reader sorts a column of the interactive table, two rules decide the order.
A number is read with the full stop as its decimal mark; a comma groups digits only in
the 1,234,567 shape and is a decimal mark otherwise, and a per-cent sign and any
whitespace are ignored – so 1.000 sorts as one. A date written as YYYY-MM-DD
is read as UTC; any other spelling is read in the reader’s own timezone, so two
spellings of the same day can order differently. Cells with no value sort last,
whichever way the column points.
class¶
Added in version 0.7.4.
You can set additional class-names for a needtable using the class option. Mostly used for HTML output.
It supports comma separated values and will add classes to the already set classes by Sphinx-Needs.
table.class_red_border {
border: 3px solid red;
}
max_items¶
Added in version 8.4.0.
The maximum number of needs to show.
We apply the limit after filtering and after the sort,
so the table keeps the first rows it would otherwise have shown,
and tells the reader how many needs it is hiding.
A truncated view says so in the page and emits a needs.max_items warning,
so that a build does not have to be read page by page to find it;
a project that caps deliberately can silence the warning with
suppress_warnings = ["needs.max_items"].
The limit counts the entries the filter returned, which are needs, and need parts alike where the filter tests
them (needs_views_include_parts);
with show_parts, a part listed under its need is not an entry of its own.
A table that sets show_parts can therefore render more rows than the limit,
since the part rows of a kept need are all still expanded.
:max_items: 0 means no limit, also for a project that sets needs_views_max_items.
Without the option, the table shows as many needs as that configuration allows.
Example 16
.. needtable::
:tags: flow_example
:style: table
:sort: id
:max_items: 2
ID |
Title |
Status |
Outgoing |
|---|---|---|---|
A requirement |
|||
A specification |
Showing the first 2 of 7 needs; refine the filter or set :max_items: (0 for all).
page_size¶
Added in version 9.0.0.
How many rows a page of the interactive table holds, for this
table alone. Overrides needs_table_page_size, and must be a positive whole number;
anything else is reported as a needs.directive warning and ignored.
A need and its parts count as one row here, so that a page
never splits a need from its parts. The option has no effect on :style: table.
Example 17
.. needtable::
:tags: flow_example
:sort: id
:page_size: 2
ID |
Title |
Status |
Outgoing |
|---|---|---|---|
A requirement |
|||
A specification |
|||
Another specification |
|||
A child specification |
|||
→ A testable part of the specification |
|||
→ Another testable part of the specification |
|||
A test case |