- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 02:13 AM
Hello,
I need help on how to include stripped rows/cells if there are no data.
I created this exmaple widget and this is result
PS: in the data.table on server side I will be getting values empty in way there is no value at all, see here -->
["Name 1"] --> just one value
["Name 2","Hover 2"] --> 2 values
Server code:
(function() {
data.table = {"data":{
"columns":["Name","Hover"],
"cells":[
["Name 1"],["Name 2","Hover 2"],["Name 3", "Hover 3"]],
}}
})();
HTML:
<div class="table-responsive"><table class="table table-condensed table-striped">
<thead>
<tr>
<th ng-repeat="col in data.table.data.columns">{{ col }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="r in data.table.data.cells">
<td ng-repeat="cell in r">{{ cell }}</td>
</tr>
</tbody>
</table></div>
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 02:40 AM
The issue is the cell is never created, therefore also not formatted. Best to solve this within the provided data.
The way the data is provided raises a second issue. namely: If the arrays in the cells do not have the same number as the columns then you dont know what the missing column is.
For example:
You got 10 columns.
in your cells array you just have 8 values.
which 2 columns should remain empty? in your code this will always be column 9 and 10 which is most likely not correct.
to solve this a solution is to add an empty value to the first cells entry (and please call it rows, it is a bit confusing) like
"cells": [
[
"Name 1",
""
],
[
"Name 2",
"Hover 2"
],
[
"Name 3",
"Hover 3"
]
]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 02:40 AM
The issue is the cell is never created, therefore also not formatted. Best to solve this within the provided data.
The way the data is provided raises a second issue. namely: If the arrays in the cells do not have the same number as the columns then you dont know what the missing column is.
For example:
You got 10 columns.
in your cells array you just have 8 values.
which 2 columns should remain empty? in your code this will always be column 9 and 10 which is most likely not correct.
to solve this a solution is to add an empty value to the first cells entry (and please call it rows, it is a bit confusing) like
"cells": [
[
"Name 1",
""
],
[
"Name 2",
"Hover 2"
],
[
"Name 3",
"Hover 3"
]
]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2022 02:50 AM
Thansk for fast and correct answer.
This is now clear, thank you!
/Petr