Can't select the row

Can't select the row

hellohellohellohello Posts: 3Questions: 1Answers: 0

When I follow the inline editing instructions to build a datatable, it occurs to me that nothing happens when I click on the select box in the first column so that I can't edit or delete row. Did I miss something?

Answers

  • jLinuxjLinux Posts: 981Questions: 73Answers: 75

    Yes, you did, you forgot to include details in your post.

  • hellohellohellohello Posts: 3Questions: 1Answers: 0

    The following is my code.My question is that when I click the select box in the first column, the row can't be selected and I can't click the edit or delete button.

    $(document).ready(function() {
    var editor_basic = new $.fn.dataTable.Editor({
    ajax: "/webmaster/wordbag/treeForm",
    table: "#wordbag_basic_table",
    fields: [{
    label: "wordbag",
    name: "wordbag"
    }
    ]
    });

      $('#wordbag_basic_table').on( 'click', 'tbody td:not(:first-child)', function (e) {
          editor_basic.inline( this );
      });
    
    var basic = [
        {'DT_RowId': 1 ,
        'wordbag':  'hello',
        'parentID': 4,
        },
    ];
    
    var datatable_basic = $('#wordbag_basic_table').DataTable({
        dom: "Bfrtip",
        data: basic,
        language: {
            paginate: {
                previous: '‹',
                next:     '›'
            },
            aria: {
                paginate: {
                    previous: 'Previous',
                    next:     'Next'
                }
            }
        },
        columns: [
          {
          data: null,
          defaultContent: '',
          className: 'select-checkbox',
          orderable: false,
          },
          { data: "wordbag" },
        ],
        select: {
          style: 'os',
          selector: 'td:first-child',
        },
        buttons: [
          { extend: "create", editor: editor_basic },
          { extend: "edit",  editor: editor_basic },
          { extend: "remove", editor: editor_basic },
        ]
    

    });

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Could you link to a test case showing the issue please? The code looks like it should work okay - I don't immediately see anything wrong with it.

    Are you using the latest versions of DataTables, Select, Editor and Buttons?

    Allan

  • hellohellohellohello Posts: 3Questions: 1Answers: 0

    I know what's wrong with it. I used the older version 1.10.7 of datatable, after I changed it to version 1.10.10, it worked. Thanks.

  • allanallan Posts: 61,650Questions: 1Answers: 10,094 Site admin

    Good to hear it works with the latest version.

    Allan

This discussion has been closed.