没有任何为Svelte创建数据表的原始示例。我找到了一些示例,我想向他们学习,但仍然行不通。现在,我正在尝试在REPL选项卡上构建它,并在结果选项卡中获得两行,但所有三个字段都相同,而是像我期望的那样唯一。
我尝试过[],切片,浓缩,每行,可能还有其他一些我现在想不起来的东西。
<script>
import { beforeUpdate, createEventDispatcher, onMount } from 'svelte';
export let faketable = [{Color:'BLUE', Car:'Camaro', Brand:'Chevy'},{Color:'RED', Car:'Pinto', Brand:'Ford'}];
export let columns = ["Color", "Car", "Brand"];
export let rows = ['blue','Camaro','Chevy'];
//export let try1 = JSON.parse(faketable);
export let clickable = true
const dispatch = createEventDispatcher();
export function click(row) {
if (!clickable) {
return;
}
if (getSelection().toString()) {
// Return if some text is selected instead of firing the row-click event.
return;
}
dispatch('row-click', row);
// console.log('click', row);
}
</script>
<div>
<h3 class="panel-title">Please work!</h3>
<table ref="table" class="table table-striped table-hover" style="width:100%">
<thead>
<tr>
{#each columns as column, x}
<th style="width: { column.width ? column.width : 'auto' }" align="center">
{column}
</th>
{/each}
</tr>
</thead>
<tbody>
{#each faketable as row, y}
<tr class="{ clickable ? 'clickable' : '' }" on:click="{() => click(row)}">
{#each columns as column, x}
<td align="center">
{row.Color}
</td>
{/each}
</tr>
{/each}
</tbody>
</table>
</div>
<style>
tr.clickable {
cursor: pointer;
}
table {
table-layout: fixed;
}
table tr td {
padding: 0 0 0 56px;
height: 48px;
font-size: 13px;
color: rgba(0, 0, 0, 0.87);
border-bottom: solid 1px #DDDDDD;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
table th {
border-radius: 0;
}
table tbody tr:hover {
background-color: #EEE;
}
</style>
标题看起来像我希望它们是颜色,汽车和品牌。但是我希望每一行都可以分别返回Blue Camaro Chevy和Red Pinto Ford。
答案 0 :(得分:1)
您有\password postgres
ERROR: cannot execute ALTER ROLE in a read-only transaction
,应该有 RMQConnectionFactory factory = new RMQConnectionFactory() ;
// ... skipping the code here
connection.start();
// set session to be transacted
session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
String queueName = managerProps.getProperty("rmq.queue.name");
Queue queue = session.createQueue(queueName);
producer = session.createProducer(queue);
TextMessage msg = session.createTextMessage(text);
msg.setText(text);
producer.send(msg);
// commit transaction
session.commit();
。 Fix that, and it works