Javascript jquery.dataTables.min.js:50未捕获类型错误:h(…).val(…).on不是函数
我呈现的这个HTML页面位于价格表页面的底部。当我尝试在表上调用DataTable时,我得到以下错误。。这很奇怪。我似乎不明白为什么会抛出这个错误Javascript jquery.dataTables.min.js:50未捕获类型错误:h(…).val(…).on不是函数,javascript,html,datatables,datatables-1.10,Javascript,Html,Datatables,Datatables 1.10,我呈现的这个HTML页面位于价格表页面的底部。当我尝试在表上调用DataTable时,我得到以下错误。。这很奇怪。我似乎不明白为什么会抛出这个错误 jquery.dataTables.min.js:50 Uncaught TypeError: h(...).val(...).on is not a function at nb (VM6942 jquery.dataTables.min.js:50) at mb (VM6942 jquery.dataTables.min.js:32) at ga
jquery.dataTables.min.js:50 Uncaught TypeError: h(...).val(...).on is not a function
at nb (VM6942 jquery.dataTables.min.js:50)
at mb (VM6942 jquery.dataTables.min.js:32)
at ga (VM6942 jquery.dataTables.min.js:48)
at e (VM6942 jquery.dataTables.min.js:92)
at HTMLTableElement.<anonymous> (VM6942 jquery.dataTables.min.js:92)
at Function.each (jquery-latest.js:45)
at init.each (jquery-latest.js:38)
at init.m [as dataTable] (VM6942 jquery.dataTables.min.js:82)
at init.h.fn.DataTable (VM6942 jquery.dataTables.min.js:164)
jquery.dataTables.min.js:50未捕获类型错误:h(…).val(…).on不是函数
在nb(VM6942 jquery.dataTables.min.js:50)
在mb(VM6942 jquery.dataTables.min.js:32)
在ga(VM6942 jquery.dataTables.min.js:48)
at e(VM6942 jquery.dataTables.min.js:92)
在HTMLTableElement。(VM6942 jquery.dataTables.min.js:92)
在Function.each(jquery latest.js:45)
在init.each(jquery latest.js:38)
在init.m[as dataTable](VM6942 jquery.dataTables.min.js:82)
位于init.h.fn.DataTable(VM6942 jquery.dataTables.min.js:164)
我的html文件:
<html>
<style>
body {
font-family: Segoe UI, Tahoma, Arial;
}
table {
font-size: 12px;
border-collapse: collapse;
border: 2px solid black;
}
#tableHead {
background-color: lightgrey
}
</style>
<body style="justify-content: justify">
<div id="tableContainer">
<div style="justify-content: center; float:left">
<table id="partsTable" class="tablesorter">
<thead id="tableHead">
<th>Price List Name</th>
<th>Part Number</th>
<th>SPA</th>
<th>Quantity</th>
<th>Quantity Type</th>
<th>Customer Part Number</th>
<th>Design Registration</th>
<th>Lead Time</th>
<th>Quoted Cost</th>
<th>Quoted User Price</th>
<th>Status</th>
</thead>
<tbody id="tableBody"></tbody>
</table>
<div id="pager" class="pager">
<form>
<img src="../_imgs/first.png" class="first" />
<img src="../_imgs/prev.png" class="prev" />
<input type="text" class="pagedisplay" />
<img src="../_imgs/next.png" class="next" />
<img src="../_imgs/last.png" class="last" />
<select class="pagesize">
<option value="">>LIMIT</option>
<option value="2">2 per page</option>
<option value="5">5 per page</option>
<option value="10">10 per page</option>
</select>
</form>
</div>
</div>
</div>
</body>
</html>
身体{
字体系列:Segoe UI、Tahoma、Arial;
}
桌子{
字体大小:12px;
边界塌陷:塌陷;
边框:2件纯黑;
}
#桌面{
背景颜色:浅灰色
}
价目表名称
零件号
温泉
量
数量类型
客户零件号
外观设计注册
订货交付时间
报价成本
用户报价
地位
>极限
每页2张
每页5张
每页10张
我的javascript:
$(document).ready(function() {
var pricelistId = getParameterByName("id");
var orgname = getParameterByName("orgname");
getPriceListItems(pricelistId, orgname);
var table = document.getElementById("partsTable");
table.border = "5";
table.style = "width: 100%; table-layout: flex;";
$("#partsTable").DataTable();
function getPriceListItems(id, orgname) {
trakPlatformClient.RequestHandler.Execute({
request: {
orgName: orgname,
messageName: "sp_get_dwpricelistitem",
parameters: [{
Key: "pt_designwinpricelistid",
Value: id
}]
},
context: this,
responseHandler: getItemSuccess,
handlerArgument: null,
errorHandler: getItemError
});
}
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function getItemSuccess(result, handlerArgument) {
var parts = new Array();
for (var i = 0; i < result.Table.Rows.length; i++) {
parts.push(result.Table.Rows[i]);
}
console.log(parts);
var tableBody = document.getElementById("tableBody");
for (var i = 0; i < parts.length; i++) {
var pt_designwinpricelistidname = parts[i].pt_designwinpricelistidname;
var pt_designwinpricelistitemid = parts[i].pt_designwinpricelistitemid;
var row = tableBody.insertRow(-1);
var hiddenCell = row.insertCell(-1);
hiddenCell.id = "pricelistID" + i;
hiddenCell.value = pt_designwinpricelistitemid;
hiddenCell.innerHTML = pt_designwinpricelistidname;
hiddenCell.style.visibility = "visible";
var pt_partidname = parts[i].pt_partidname;
var am_spaname = parts[i].am_spaname;
var am_quantitytype = parts[i].am_quantitytype;
var quantity = parts[i].quantity;
var am_customerpartnumber = parts[i].am_customerpartnumber;
var pt_designregistrationpartidname = parts[i].pt_designregistrationpartidname;
var am_leadtime = parts[i].am_leadtime;
var am_quotedcost = parts[i].am_quotedcost.toPrecision(5);
var am_quoateduserprice;
if (parts[i].am_quoteduserprice != null) {
am_quoateduserprice = parts[i].am_quoteduserprice.toPrecision(5);
} else {
var num = 0
am_quoateduserprice = num.toPrecision(5);
}
var statuscode = parts[i].statuscode;
var statuscodename;
if (statuscode == 1) {
statuscodename = "Active";
} else {
statuscodename = "Inactive";
}
var quantitytypename;
if (am_quantitytype == 1) {
quantitytypename = "Annual"
} else if (am_quantitytype == 2) {
quantitytypename = "Quarterly"
} else {
quantitytypename = "One Shot"
}
var attributes = new Array();
attributes.push(pt_partidname);
attributes.push(am_spaname);
attributes.push(quantity);
attributes.push(quantitytypename);
attributes.push(am_customerpartnumber);
attributes.push(pt_designregistrationpartidname);
attributes.push(am_leadtime);
attributes.push(am_quotedcost);
attributes.push(am_quoateduserprice);
attributes.push(statuscodename);
for (var j = 0; j < attributes.length; j++) {
var cell = row.insertCell(-1);
cell.innerHTML = attributes[j];
if (j == 0) {
cell.style = "text-decoration: underline";
}
}
}
}
function getItemError(e, s, t) {
console.log(e);
}
});
$(文档).ready(函数(){
var pricelistId=getParameterByName(“id”);
var orgname=getParameterByName(“orgname”);
getPriceListItems(pricelistId、orgname);
var table=document.getElementById(“partsTable”);
table.border=“5”;
table.style=“宽度:100%;表格布局:flex;”;
$(“#partsTable”).DataTable();
函数getPriceListItems(id、orgname){
trakPlatformClient.RequestHandler.Execute({
请求:{
orgName:orgName,
messageName:“sp_get_dwpricelistitem”,
参数:[{
密钥:“pt_designwinpricelistid”,
值:id
}]
},
背景:这,,
负责人:getItemSuccess,
handlerArgument:null,
errorHandler:getItemError
});
}
函数getParameterByName(名称、url){
如果(!url)url=window.location.href;
name=name.replace(/[\[\]]/g,\\$&);
var regex=new RegExp(“[?&]”+name+”(=([^]*)和|#|$),
结果=regex.exec(url);
如果(!results)返回null;
如果(!results[2])返回“”;
返回组件(结果[2]。替换(/\+/g,”);
}
函数getItemSuccess(结果、handlerArgument){
var parts=新数组();
对于(var i=0;i