0

我可以使用 jQuery 在数据表中创建和编辑记录。我在删除记录时遇到问题。这是我的代码。谢谢您的帮助。

   // New record
   $('a.editor_create').on('click', function (e) {
      e.preventDefault();

      editor.create(
          'Create new record', {
          "label": "Add",
          "fn": function () {
              editor.submit()
          }
      });
  });

  // Edit record
  $('#example').on('click', 'a.editor_edit', function (e) {
      e.preventDefault();

      editor.edit(
      $(this).parents('tr')[0],
          'Edit record', {
          "label": "Update",
          "fn": function () {
              editor.submit()
          }
      });
  });
  $('#example').dataTable({
      "sDom": "Tfrtip",
          "sAjaxSource": "browsers1.json",
          "aoColumns": [{
          "mData": "sn"
      }, {
          "mData": "reg_name"
      }, {
          "mData": "audit_name"
      }, {
          "mData": "audit_data"
      }, {
          "mData": "minor",
          "sClass": "center"
      }, {
          "mData": "major",
          "sClass": "center"
      }, {
          "mData": null,
              "sClass": "center",
              "sDefaultContent": '<a href="" class="editor_edit">Edit</a>'
      }]
  });
4

0 回答 0