How do properly use api function edit()

How do properly use api function edit()

hhsiaohhsiao Posts: 12Questions: 4Answers: 0

I have need to have "edit()" panel show up when I click on a particular cell, I tried replacing my "bubble()" call with "edit()", however all I get is an empty field on the panel.

I also tried passing it object like follow:

editor.edit({
    cells: table.cell(this).data(),
    rows: table.row(this).data(),
})

However I still get blank.

Now following does work, except it's editing for the entire row, I want to only edit the cell

editor.edit({
    rows: table.row(this).data(),
})

Following also work, except it's editing for the entire column, which is peculiar since the variable I gave it specifically says cells

editor.edit({
    cells: table.cell(this).data(),
})

This question has an accepted answers - jump to answer

Answers

  • hhsiaohhsiao Posts: 12Questions: 4Answers: 0

    I can now get the editor to show up, I was doing it wrong... it should've been the following

    editor.edit({
        cells: table.cell(this).indexes(),
    })
    
  • hhsiaohhsiao Posts: 12Questions: 4Answers: 0

    I do have further question, I am using fixed column and scrolling rows (so there are more rows than the screen can display).

    Whenever I am done editing, my fixed column is scrolled back up to the top, but as soon as I do any sort of vertical scrolling it jumps back to the current location.

  • hhsiaohhsiao Posts: 12Questions: 4Answers: 0

    So I ghetto fixed this, I attached this to the fixed column div

    $(".DTFC_LeftBodyLiner").on("scroll", function() {
        console.log("Left:" + $(this).scrollTop() + "  Right:" + $(".dataTables_scrollBody").scrollTop());
    })
    

    So basically, after I hit update on the editor, the fixed column div was scrolled to 0 "twice", I could't bother figuring out why it did that... so I attached this to "fix" it (well it's not really fixed... but hey it does exactly what I need):

    $(".DTFC_LeftBodyLiner").on("scroll", function() {
        var scrollBody = $(".dataTables_scrollBody").scrollTop();
        var scrollFixed = $(this).scrollTop();
        if (scrollBody != scrollFixed) {
            $(this).scrollTop(scrollBody);
        }
    });
    
  • allanallan Posts: 63,799Questions: 1Answers: 10,514 Site admin
    Answer ✓

    Thanks for posting your workaround - that does sound like a bug. The fixed column should not be jumping anywhere - the original position should be retained.

    Allan

This discussion has been closed.