javascript - 使用 javascript 和 crm 数据在 html 中创建表
问题描述
在我的 javascript 文件中,我正在尝试使用 html 创建一个表。
我有一个实体的记录列表,其中包含合同 ID、姓名、地址等字段。
var filter = "?$select=*&$filter=_plus_franchisee_value eq " + serviceProviderID;
PlusCRM.RetrieveMultiple("plus_franchiseecontracts", filter, function (records) {
$("#tblNewAssignments").find("tbody").empty();
console.log("vendorcontracts list....................");
console.log(records);
});
在表格的第一列中,我想显示应该显示所有合同 ID 的下拉列表。选择 id 后,第 2 列和第 3 列应填充其各自的名称和地址。填满后,应出现第二行,下拉菜单应再次显示帐户列表。
html:
<body onfocusout="parent.setEmailRange();" style="overflow-wrap: break-word;">
<div class="row">
<div class="col-md-12">
<h5>New Assignments</h5>
<hr>
<div id="divNewAssignments">
<table id="tblNewAssignments">
<thead>
<tr>
<th>Vendor Contract</th> (this should be drop down)
<th>Volume Purchased</th>
<th>% Fulfilled</th>
<th>Volume Owed</th>
<th>Vendor Amount</th>
</tr>
</thead>
<tbody></tbody>
<tfoot></tfoot>
</table>
<div class="inline-loader"></div>
<div class="no-records" style="display: none">No records found</div>
</div>
</div>
</div>
</body></html>
请帮助我实现这一目标。
谢谢
解决方案
这可能对你有帮助,我不确定。 使用 html 在表格中添加下拉列表
如果你想用 javascript 做同样的事情,你可以这样做。
function func(){
var addrow = '<tr>'
addrow += <td>'
addrow += '<select>
<option value="">record1</option>
<option value="">record2</option>
<option value="">record3</option>
<option value="">record4</option>
</select>'
addrow += '</td>'
addrow += '</tr>'
for(var i = 0; i < length_of_records; i++){
jQuery("#tblNewAssignments tbody").append(addrow);
}
}
推荐阅读
- jquery - 滚动 jquery var 上的粘性导航未更新
- html - 选择与文本内联的元素
- php - 在 php 中使用 sqlsrv 调用 SQL 存储过程并获取返回成功或失败
- ios - swift for循环遍历json对象不会为字符串添加值
- laravel - Laravel Horizon worker:空闲内存使用
- c++ - 如何将一些文本保存到包含空格的字符串中?
- android - 如何使用 FCM 在颤振中推送通知
- javascript - 我的自定义滑块图像显示在原始域上,但不在虚拟域上(仅适用于移动设备)
- python - Docker Python API 更新方法生成 TypeError: unhashable type: 'dict'
- python - 错误:无法为使用 PEP 517 且无法直接安装的 esmre 构建轮子