подвижные колонки таблицы
$(function() {
$(".draggable").draggable();
});
.headerTableau {
background: #E4E3E1;
color: #8A2336;
text-shadow: 0 1px 1px gray;
}
.bodyTableau {
padding: 10px 20px;
background: #faf5f6;
}
.draggable {
cursor: -webkit-grabbing;
}
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<div class="movableTableau ui-widget-content draggable">
<table>
<thead>
<tr class="headerTableau">
<th>колонна1</th>
<th>колонна2</th>
<th>колонна3</th>
<th>колонна4</th>
<th>колонна5</th>
</tr>
</thead>
<tbody class="bodyTableau ">
<tr>
<th>текст1</th>
<th>текст2</th>
<th>текст3</th>
<th>текст4</th>
<th>текст5</th>
</tr>
</table>
</div>
кто-то знает как сделать колонки таблицы подвижными, чтоб можно было поменять колонку1 с колонкой2
таблица на Blazor Assembly на C# (поэтому ставлю метку), может есть готовые решения ?
двигает всю таблицу тут вот посмотрела как на Js сделано применяется к Div-у, к колонам не получилось
Если можно без использования Js, может библиотека какая делает для Веб Страниц на Блазор
нашла решение в bootstrap, именно то, что я ищу, колонки подвижные только у меня не получается использовать их код
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/akottr/dragtable@master/dragtable.css">
<script src="https://cdn.jsdelivr.net/npm/jqueryui@1.11.1/jquery-ui.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/akottr/dragtable@master/jquery.dragtable.js"></script>
<div class="toolbar">
<button class="btn btn-primary" id="order1">Order by Name, ID, price</button>
<button class="btn btn-primary" id="order2">Order by Price, Name, ID</button>
</div>
<table id="table" data-toolbar=".toolbar" data-show-columns="true" data-search="true" data-show-toggle="true" data-pagination="true" data-url="json/data1.json" data-reorderable-columns="true">
<thead>
<tr>
<th data-field="id" data-sortable="true">ID</th>
<th data-field="name" data-sortable="true">Item Name</th>
<th data-field="price" data-sortable="true">Item Price</th>
</tr>
</thead>
</table>
<script>
$(function() {
$('#table').bootstrapTable()
$('#order1').on('click', () => {
$('#table').bootstrapTable('orderColumns', {
name: 0,
id: 1,
price: 2
})
})
$('#order2').on('click', () => {
$('#table').bootstrapTable('orderColumns', {
price: 0,
name: 1,
id: 2
})
})
})
</script>
Источник: Stack Overflow на русском