[英]Uncaught SyntaxError: missing ) after argument list when trying to add a function to sort data
I am getting the error:我收到错误:
Uncaught SyntaxError: missing ) after argument list参数列表后未捕获的 SyntaxError: missing )
with the below Javascript:使用以下 Javascript:
jQuery.extend(cipMonitorErrorsSettings, { loadOnStartup: true, columnDefs: [{ "mData": "createdDate", "bSortable": true, "sTitle": '<fmt:message key="card.cipErrors.createdDate"/>', "mRender": function(data, type, cipErrors) { //new return '<button class="cipSummary buttonlink createdDate">' + cipErrors.createdDate + '</button>'; //new } }, { "mData": "status", "bSortable": true, "sTitle": '<fmt:message key="card.cipErrors.status"/>' }, { "mData": "jsonRequest", "sTitle": '<fmt:message key="card.cipErrors.jsonRequest"/>' }, { "mData": "jsonResponse", "sTitle": '<fmt:message key="card.cipErrors.jsonResponse"/>' } ], editLinks: [{ //Edit selector: ".cipSummary", callback: function(target, data) { // debugger; $ { prefix } ActionFormHandler.open(data); }, disabled: $ { actionBean.restricted['RESTRICT_EDIT'] } }], postInitCallback: function() { console.log(this.container.find(".appendImage")); }, actionButtons: { exportText: '<fmt:message key="export.csv"/>' } } $(document).ready(function(data) { $('#cipTable').DataTable({ "order": [ [3, "desc"] ], "columnDefs": [{ targets: 0, data: "createdDate" }, { targets: 1, data: "status" }, { targets: 2, data: "jsonRequest" }, { targets: 3, data: "jsonResponse" } ] }) }); );
I have checked and double-checked and tried many times, but still cannot get rid of this error.我已经检查和仔细检查并尝试了很多次,但仍然无法摆脱这个错误。 I also added a debugger but can locate where it is happening.我还添加了一个调试器,但可以找到它发生的位置。 I am trying to display the columns but sort by createdDate
column.我试图显示列,但按createdDate
列排序。
Try your script like this, i removed the last ");"像这样试试你的脚本,我删除了最后一个“);” at end of script.在脚本的末尾。
jQuery.extend(cipMonitorErrorsSettings, { loadOnStartup: true, columnDefs: [{ "mData": "createdDate", "bSortable": true, "sTitle": '<fmt:message key="card.cipErrors.createdDate"/>', "mRender": function(data, type, cipErrors) { //new return '<button class="cipSummary buttonlink createdDate">' + cipErrors.createdDate + '</button>'; //new } }, { "mData": "status", "bSortable": true, "sTitle": '<fmt:message key="card.cipErrors.status"/>' }, { "mData": "jsonRequest", "sTitle": '<fmt:message key="card.cipErrors.jsonRequest"/>' }, { "mData": "jsonResponse", "sTitle": '<fmt:message key="card.cipErrors.jsonResponse"/>' } ], editLinks: [{ //Edit selector: ".cipSummary", callback: function(target, data) { // debugger; $ { prefix } ActionFormHandler.open(data); }, disabled: $ { actionBean.restricted['RESTRICT_EDIT'] } }], postInitCallback: function() { console.log(this.container.find(".appendImage")); }, actionButtons: { exportText: '<fmt:message key="export.csv"/>' } } $(document).ready(function(data) { $('#cipTable').DataTable({ "order": [ [3, "desc"] ], "columnDefs": [{ targets: 0, data: "createdDate" }, { targets: 1, data: "status" }, { targets: 2, data: "jsonRequest" }, { targets: 3, data: "jsonResponse" } ] }) });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.