Uncaught SyntaxError: отсутствует) после списка аргументов при попытке добавить функцию для сортировки данных - PullRequest
0 голосов
/ 30 января 2020

Я получаю сообщение об ошибке:

Uncaught SyntaxError: отсутствует) после списка аргументов

со следующим 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"
        }
      ]
    })
  });
);

Я проверял и дважды проверял и пробовал много раз, но все еще не могу избавиться от этой ошибки. Я также добавил отладчик, но могу определить, где это происходит. Я пытаюсь отобразить столбцы, но сортирую по столбцу createdDate.

1 Ответ

1 голос
/ 30 января 2020

Попробуй свой скрипт вот так, я удалил последний ");" в конце сценария.

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"
        }
      ]
    })
  });
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...