Inline edit in fixed column

Inline edit in fixed column

jgessingerjgessinger Posts: 38Questions: 6Answers: 0
edited November 2016 in Editor

Hello Allan,

I am using the inline edit feature and had an error when jumping from one inline edit field to another one, because the table reloaded and I lost the reference to the cell. I fixed this issue with your recommendation from another thread ( see https://datatables.net/forums/discussion/31895 ).

Now I have a little problem with this fix in combination with fixed columns. When I click on a cell in a fixed column and try to call the .inline() method, nothing happens. But it is working in the cells in the scrolling columns. When I use the .bubble() method it is also working in the fixed columns. After disabling the fixed columns, I can use the .inline() method without a problem.

Example: http://live.datatables.net/vusitoja/1/edit (While the edit feature is not working here, you have to copy the code)

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    The problem is the selector that is being used for the click event handler - it is only being applied to the original table, not any of the floating components.

    If you have a look at this example of inline editing with FixedColumns you'll be able to see how it can be done.

    Allan

  • jgessingerjgessinger Posts: 38Questions: 6Answers: 0

    Its not the selector that causes the problem in my live example (cant publish it to the internet). Maybe the example I gave you is wrong.

    But we could use your posted example and extend it. The problem should occur, when you replace line 71:
    editor.inline( this );
    with
    editor.inline(table.cell(this).index());
    The inline edit should then be broken in the fixed column but still work in the other ones.

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Right, but the fixed column cells aren't in the table - they are floating over the original table. You have to use this to let Editor be able to insert the input elements into the fixed column. If you pass in the cell index, it will try to insert it into the original cell (which is behind the fixed column).

    Regards,
    Allan

  • jgessingerjgessinger Posts: 38Questions: 6Answers: 0
    edited November 2016

    Ok, and thats the reason why .bubble() is working because its creating a light popup.

    To solve my problem:
    Inside fixed columns: table.inline(this);
    Outside fixed columns: table.inline(table.cell(this).index());

    That really seems to work, but I don't understand why I get the "k is undefined" error in the scrolling part but not in the fixed column when jumping between inline cells. :smile:

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    You should only need one of them like in my example. If you have a link to your page I can take a look to see what is going on.

    Allan

  • jgessingerjgessinger Posts: 38Questions: 6Answers: 0
    edited November 2016

    With table.inline(this); only I get the same error as described in this thread https://datatables.net/forums/discussion/31895 and with table.inline(table.cell(this).index()); only I have the described problem in this thread, so I cant enter the inline edit mode.
    Both combined (as written above) is working without a problem, so you can see this as solved. I am just wondering why, but it is ok for me :P

This discussion has been closed.