gpt4 book ai didi

jquery - 在 div 中重新加载表,列被压扁

转载 作者:行者123 更新时间:2023-11-28 16:31:09 25 4
gpt4 key购买 nike

我有一个面板主体内包含多个表格的页面。其中一个表,在行 div 和面板 div 内,我想在用户生成后重新加载,然后关闭模态。我的代码有效,但是当重新加载表格时 it gets squashed like so .

是否无法在面板主体内重新加载表格?

编辑:表格首先像这样包含在底部:

<div class="row">
<!-- Sales by Month -->
<div class="col-md-4">
<h3 class="text-center">Sales By Month</h3>
<table class="table table-bordered table-striped table-condensed">
<thead><th></th><th><?=$last_year;?></th><th><?=$this_year;?></th></thead>
<tbody>
<?php for ($i = 1; $i <= 12; $i++):
$dt = DateTime::createFromFormat('!m',$i);
$t = $this_array[$i]?? 0;
$l = $last_array[$i]?? 0;
$this_total += $t;
$last_total += $l;
?>
<tr>
<td><?=$dt->format("F");?></td>
<td><?=money($l);?></td>
<td><?=money($t);?></td>
</tr>
<?php endfor ;?>
<tr>
<td style="font-weight:bold" class="text-center">Year Total:</strong><td><?=money($last_total);?></td><td><?=money($this_total);?></td>
</tr>
</tbody>
</table>
</div>
<!-- Low Inventory -->
<?php include 'low_inventory.php'; ?>

</div>
</div> <<<<<< this div closes the whole panel

页面本身是这样的:

<div id="low-inventory" class="col-md-8">
<?php
require_once 'core/init.php';
$low_inventory = $db->query("SELECT a.stock, a.id AS 'stock_id', a.product_id, a.threshold, b.title, c.size FROM stock a JOIN products b ON a.product_id = b.id
JOIN sizes c ON a.size = c.id WHERE (stock < 5 AND threshold = 0) OR (stock < threshold AND threshold > 0) ORDER BY stock ASC");
?>

<h3 class="text-center">Low Inventory</h3>
<table class="table table-bordered table-striped table-condensed table-hover table-hand-pointer">
<thead class="noninteractive"><th>Product</th><th>Size</th><th>Stock</th><th>Stock ID</th><th>Threshold</th></thead>
<tbody>
<?php while($low = mysqli_fetch_assoc($low_inventory)): ?>
<tr <?=empty($low['stock'])? 'class="danger" ':'';?> onclick=show_stock(<?=$low['product_id'];?>)>
<td><?=$low['title'];?></td>
<td><?=$low['size'];?></td>
<td><?=$low['stock'];?></td>
<td><?=$low['stock_id'];?></td>
<td><?=$low['threshold'];?></td>
</tr>
<?php endwhile ;?>
</tbody>
</table>
</div>

并由此重新加载:

$("#low-inventory").load("<?=ADMINURL;?>low_inventory.php");

最佳答案

<div id="low-inventory" class="col-md-8">外面low_inventory.php :

<div id="low-inventory" class="col-md-8">
<?php include 'low_inventory.php'; ?>
</div>

否则在重新加载后你会被双重包裹:

<div id="low-inventory" class="col-md-8">
<div id="low-inventory" class="col-md-8">
...

关于jquery - 在 div 中重新加载表,列被压扁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35291550/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com