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.
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 |
|
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 |
|
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 |
||
My requirement |
||
Test of requirements |
||
A feature |
||
(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 |
|
Feature 1 |
||
Feature 2 |
||
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 |
|
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 |
||
→ Part 1 of requirement |
||
→ Part 2 of requirement |
||
→ Part 3 of requirement |
||
Specifies part 1 |
||
Specifies part 2 |
||
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_extra_options) 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.
DataTable 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 |
20 |
False |
True |
False |
This need has id :ndf:`copy("id")` and status :ndf:`copy("status")`. |
|
My first requirement |
requirement; test; awesome |
open |
filter |
425 |
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 |
445 |
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 |
20 |
False |
True |
False |
This need has id :ndf:`copy("id")` and status :ndf:`copy("status")`. |
|
My first requirement |
requirement; test; awesome |
open |
filter |
425 |
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 |
445 |
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:
table
datatables
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 |
||
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 |
|||
Use needs_string_links |
|||
Feature A |
|||
Feature B |
done |
||
Requirement 1 |
|||
Requirement 2 |
|||
needextend Example 1 |
closed |
||
needextend Example 2 |
New status |
||
needextend Example 3 |
open |
||
needextend Example 4 |
open |
||
needextend Example 5 |
open |
||
needextend Example 6 |
open |
||
My requirement |
|||
Test of requirements |
|||
A feature |
|||
(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 |
|||
Feature 1 |
|||
Feature 2 |
|||
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 |
||
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 |
spec_flow_002; spec_flow_001.subspec_1; spec_flow_001.subspec_2 |
||
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 |
||
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 |
|||
Use needs_string_links |
|||
Feature A |
|||
Feature B |
done |
||
Requirement 1 |
|||
Requirement 2 |
|||
needextend Example 1 |
closed |
||
needextend Example 2 |
New status |
||
needextend Example 3 |
open |
||
needextend Example 4 |
open |
||
needextend Example 5 |
open |
||
needextend Example 6 |
open |
||
My requirement |
|||
Test of requirements |
|||
A feature |
|||
(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 |
|||
Feature 1 |
|||
Feature 2 |
|||
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 |
||
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 |
spec_flow_002; spec_flow_001.subspec_1; spec_flow_001.subspec_2 |
||
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.
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
No needs passed the filters
Show above example’s configuration
Example 10
.. req:: Test need with need parts
:id: table_001
: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
:links: table_001.1
.. spec:: Specifies part 2
:id: table_003
: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, and the addressed need-value
must have the type string
, float
or int
.
By default, we use id_complete
if we don’t set a sort option.
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
Sorting only works if you use the standard sphinx-table for output: :style: table
.
By default, tables generated with DatabTables uses Javascript to sort results.
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;
}