I had to solve a specific problem that I'm going to explain using an image to better understand the question.
Basically the result that I wanted to obtain is this:
The white rows are the main items and the gray ones are subitems of the main. To achieve this with Bootstrap Vue tables I pass to the main table (the one contained in every accordion tab) the array with all the main items, and every main item has his subItems set contained in an array. Now to render the grey rows for every white row I used the row details slot in which I put another b-table that receives as items the subItems of the main row.
This solution looks fine but it comes with some important problems:
first of all I had to reset the row-details padding in order to align the outer table with the inner table, but it still has some differences in width (if you look close between the TDs there are some differences)
as second point, the most important one, every row has to be selectable only one per time, in order to modify the infos contained inside. At the moment I set the outer table selectable with only one row per time, and same for the inner tables, but since these are more than one it creates conflicts every time I select rows on different subitems or if I select a main item together with one or more subitems.
Now my question is:
before I proceed finding a solution maintaining the actual structure that I built, I was wondering if there is a better way to achieve this without nesting tables and at the same time maintaining the actual look of the entire table.
If this can help, I post the piece of code related to the result seen in the above image:
// OUTER TABLE
<b-table
:items="dataTable.itemsOnDesktop"
:fields="billOfMaterialsType == '2' ? dataTable.fields : dataTable.fieldsA1"
:selectable="isSelectable"
#row-selected="onRowSelected"
ref="selectableTable"
outlined
sticky-header="700px"
head-variant="light"
select-mode="single"
stacked="md"
selected-variant="danger"
details-td-class="row-details-styling"
id="outer-project-table"
bordered
fixed
:busy="tableBusy"
>
.
.
.
<template
v-if="billOfMaterialsType == '2'"
#row-details="row"
>
// INNER TABLE
<b-table
id="inner-project-table"
hover
table-variant="secondaryLight"
selected-variant="danger"
select-mode="single"
#row-selected="onRowSelected"
:selectable="isSelectable"
thead-class="hidden_header"
:fields="dataTable.fields"
:items="row.item.node.bomiteminfoSet.edges"
:ref="`innerTable-${row.item.node.id}`"
bordered
small
fixed
>
.
.
.
</b-table>
</template>
</b-table>
And here it is a short example of the dataTable.itemsOnDesktop json structure:
[{
"node": {
"id": "Qk9NSXRllE2vZGU6MjA2MzU=",
"code": "1.4.7.2.a",
"description": " INTONACO COMPLETO AL CIVILE PREMISCELATO A PROIEZIONE ...",
"quantity": "1290.00",
"unitOfMeasurement": "m2",
"bomiteminfoSet": {
"edges": [{
"node": {
"id": "Qk9YinRlbUalk87230mGlOjExOTkx",
"code": null,
"description": "PORZIONE BURLOTTI\npiano interrato, piano terra",
"parts": "955.00",
"length": null,
"width": null,
"heightOrWeight": null,
"unitOfMeasurement": null,
"quantity": "955.00"
}
},
{
"node": {
"id": "Qk9ld5RlSXRlbUaOb2RlOjExOTky",
"code": null,
"description": "PORZIONE LAZZARINI\npiano terra",
"parts": "335.00",
"length": null,
"width": null,
"heightOrWeight": null,
"unitOfMeasurement": null,
"quantity": "335.00"
}
}]
}
},
"isActive": true,
"_showDetails": true
}]
Let me know your ideas about this, I would really appreciate it.
Related
I have 2 different JSON arrays displayed separately using a simple *ngFor loop on the same page. Ex-
json1: [ {
"order": 1,
"similarity": 0.82,
"sentence": "I would like to speak with :name:.",
"matching_sentence": "Hello, I would like to speak with Luke.",
"matching_line": 0
}]
json2: [ {
"order": 0,
"similarity": 0.82,
"sentence": "Hello, I would like to speak with Luke.",
"matching_sentence": "I would like to speak with :name:.",
"matching_line": 1,
"channel": 1,
"timeFrom": 15,
"timeTo": 20
}]
So, order property from json1 matches matching_line property of json2 and vice versa. So, what I need to achieve is that on mouse hover of json1, json2 should also be highlighted and on mouse hover of json2, json1 should also be highlighted.
This code is written in Angular 11 so, any solution whether it is by css or typescript is welcome.
You can achieve it using mouse enter leave events and keeping track of the active class
<div
*ngFor="let item of json1"
[ngClass]="{'highlight': item.order === activeHover}"
(mouseenter)="onHoverChange(item.order)"
(mouseleave)="onHoverChange(null)">
{{item.sentence}}
</div>
<div
*ngFor="let item of json2"
[ngClass]="{'highlight': item.matching_line === activeHover}"
(mouseenter)="onHoverChange(item.matching_line)"
(mouseleave)="onHoverChange(null)">
{{item.sentence}}
</div>
// in ts file
onHoverChange(value: number | null) {
this.activeHover = value;
}
Running sandbox link
I have a simple time-series in highchart:
series: [{
"data": [[Date.UTC(2021,0,1), 22312], // January
[Date.UTC(2021,1,1), 12312], // Feburary
[Date.UTC(2021,2,1), 23322], // ... etc.
],
Now I want to zoom into one month, and show just one column with the given code:
rangeSelector: {
buttons: [{
text: '1m',
type: 'month',
count: 1, // This should show only 1 month, but it shows 2.
// If this is changed to "0", one month will be show, but
// The css "highcharts-button-pressed" is disabled, and you cannot
// see that "1m" was clicked.
},
According to documentation "rangeSelector.buttons.count" should span over an area of one month if type is "month" and count is "1". But what I´m getting here is a span over two months.
Here is an example:
https://jsfiddle.net/ds90vf5r/1/
Question 1: Why is higchart showing two columns instead of one when choosing/clicking on just 1-month (1m)?
Question 2: How can I zoom into the current date and show just one moth (or one column)?
how can I get Query all the users in a specific BIM 360 account? with no limit, because I have over 100 users :
max limit means the limit of one page (the call of one time).e.g. if you set 50, then every call, 50 items only. By default offset = 0. It means starting with the first item. i.e. one call with limit=50&offset=0 will give you No. 0-49 items only.
one call with limit=50&offset=120 will give you No. 120-169 items only.
The response of the call will tell pagination info. e.g. when I set limit=2&offset=0. It tells total number of users is 10. The next page (nexturl) will be from No 2,3.
"pagination": {
"limit": 2,
"offset": 0,
"totalResults": 10,
"nextUrl": "https://developer.api.autodesk.com/bim360/admin/v1/projects/xxxxxx-
5d39-43cb-b4c4-xxxxxx/users?limit=2&sort=name&offset=2"
},
If calling nexturl, it will tell the url of previous page(No 2,3 only) and next page (No 4,5 only).
"pagination": {
"limit": 2,
"offset": 2,
"totalResults": 10,
"nextUrl": "https://developer.api.autodesk.com/bim360/admin/v1/projects/xxxxxx-
5d39-43cb-b4c4-xxxxxx/users?limit=2&offset=4&sort=name",
"previousUrl":
"https://developer.api.autodesk.com/bim360/admin/v1/projects/xxxxxx-5d39-43cb-b4c4-
xxxxxx/users?limit=2&offset=0&sort=name"
},
And my colleague Petr's sample will be also a good reference for coding.
Everytime Watson can't answer a question or a comment it pulls up the "everything_else" node that says 'Sorry, I don't know bla bla bla". I want Watson to send and specific message to the user after three failed attempts. How do I do it?
I read this page (https://console.bluemix.net/docs/services/assistant/dialog-slots.html) but I could not apply the solution given.
My 'anything_else' Json
{
"output": {
"generic": [
{
"time": 2000,
"typing": true,
"response_type": "pause"
},
{
"values": [
{
"text": "Ainda não tenho todas as respostas, talvez reformular a frase ajude..."
},
{
"text": "Perdão, acho que não entendi. Tente inserir palavras chave ou reformular a frase."
},
{
"text": "Sorry! Essa eu não sei... Tente algumas palavras chave, pode me ajudar a entender!"
}
],
"response_type": "text",
"selection_policy": "random"
}
]
}
}
There are two approaches.
Approach 1:
Change your responses from random to sequential. This works fine if your users are not expected to hit that topic that often, or are "tyre kickers" (playing with system, but not using as expected).
For example, in an off topic you may give 2 responses to it, but the third tells them to stop playing.
Approach 2:
Have two anything_else nodes. The first node checks if a counter is over a certain value. The logic for that would be something like:
If $counter < 3
In the node you would give the normal "I don't understand", and increment the counter.
Important Make sure you have created a default $counter variable and set it (in your welcome node is good).
The second anything_else node after it would give your expected response you want. You can optionally reset the counter at this point.
Added option would be to have a flag that checks if you hit the first anything_else. If you didn't then reset your counter.
An example of this would be if someone asked too many off topic questions in a row you might want to stop them, but if they go on topic you reset to prevent misunderstandings being picked up as off topic.
I am creating a simple time-based data plot using amcharts with has 5 values, its working great but every time there is 2 or more readings with the same value it stack up and only 1 bullet is visible, i tried to create a custom bullet but still no luck.
Is there a way to separate the bullets individually just to make it presentable.
Below is my code.
{
"bullet": "round",
"bulletBorderAlpha": 1,
"bulletColor": "#2980b9",
"bulletSize": 19,
"customBulletField": "bullet",
"id": "reading_4",
"lineThickness": 0,
"title": "reading_4",
"showHandOnHover": true,
"valueField": "column-8",
"balloonText": "<div style='margin:5px; font-size:12px;'>Reading 4: <b>[[value]]</b></div>",
"visibleInLegend": false,
},
Is there away to make it like below