如何解决手风琴表js
代码表:
dumb\n10001\n16\ngirl\nABC\n1002\n56\nboy\n
dumb\n10001\n16\ngirl\nABC\n1002\n56\nboy\nrl\nABC\n1002\n56\nboy
代码JS:
{
"source": [
"aws.sts"
],"detail-type": [
"AWS API Call via CloudTrail"
],"detail": {
"eventSource": [
"sts.amazonaws.com"
],"eventName": [
"AssumeRoleWithWebIdentity"
]
}
}
它返回我“未定义”
解决方法
为了测试,我已经将PHP转换为HTML。
检查此代码段。我选择了要显示红色的行。
但是必须找到正确的行:
$('#id_tabella tr.view').last()
var lastRow = $('#id_tabella tr').last();
lastRow.css('background','red'); // TEST which row we found
var ultimo = lastRow.attr("Id");
console.log(ultimo);
// Now make a correction
lastRow = $('#id_tabella tr.view').last();
ultimo = lastRow.attr("Id");
console.log(ultimo); // Now Good!
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table id="id_tabella" class="fold-table" align="center" style="margin-bottom:40px">
<thead>
<tr>
<th style="">Id</th>
<th>OrderCode</th>
<th>Partner</th>
<th>NrProdotti</th>
<th>Totale</th>
<th>Stato</th>
</tr>
</thead>
<tbody>
<tr id="id1" class="view">
<td style="">id1</td>
<td>OrderCode</td>
<td><img align="middle" src="#" width="10%"></td>
<td>NrProdotti</td>
<td>TotaleOrdine</td>
<td>
<form method="POST" action="">
<input name="idOrdine" value="id1" type="submit">
</form>
</td>
</tr>
<tr class="fold">
<td colspan="6">
<div class="fold-content">
<h3>DETTAGLIO ORDINE</h3>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
<table>
<thead>
<tr>
<th>Dettaglio Ordine:</th>
</tr>
</thead>
<tbody>
<tr>
<td>XXX
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
因此在您的代码中,您发现了实际上是这一行的“最后”行:
<td>
<?php
$data = json_decode($result['JsonOrdine'],true);
foreach($data['products'] as $key=>$val){
echo '<b>'.$val['name'].' * '.$val['quantity'].'</b><br>';
foreach($val['attributes'] as $keys=>$value){
echo $value['name'].' * '.$value['quantity'].'<br>';
}
}
?>
</td>
因此,请尝试将搜索更改为:
var ultimo = $('#id_tabella tr.view').last().attr("Id");
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。