cell.invalidate() error

cell.invalidate() error

idleogidleog Posts: 6Questions: 1Answers: 0

Hi
I have following problem:

Calling a cell.invalidate() throws error line 1671

TypeError: row.getAttribute is not a function
var id = row.getAttribute( 'id' );

I'm doing:

api.on('click','.btn',function() { 
.... [changing some content in cell]
var cell = api.cell(me.closest('td'));
console.log(cell.data());
cell.invalidate();
...

Latest Firefox/Chrome on Mac
DataTables 1.10.8
http://debug.datatables.net/ibipoz

Did I miss something?

Cheers, Peter

This question has an accepted answers - jump to answer

Answers

  • ThomDThomD Posts: 334Questions: 11Answers: 43
    edited August 2015

    Where are you setting 'me' and what is the output of the console.log call?

    I think you want

    $(this).closest('td')

  • idleogidleog Posts: 6Questions: 1Answers: 0

    'me' is referenced to $(this) (which is the button triggering the event within the cell).

    Console output is the actual html string of the cell.

  • ThomDThomD Posts: 334Questions: 11Answers: 43

    Check this live tables example.

    http://live.datatables.net/japiteto/1/edit

    Only the cell for Garret Winters has the on click event.

    I think it is doing what you are looking for and does not throw an error.

  • idleogidleog Posts: 6Questions: 1Answers: 0

    thanks, ThomD

    It works in the live example, but after clicking on Garret Winters, when I switch a panel (e.g. css) an alert is shown:

    DataTables warning: table id=example - Requested unknown parameter '1' for row 1. For more information about this error, please see http://datatables.net/tn/4
    

    And: When I go back to DataTales 1.10.7, It works in my example. The cell is invalidated without error.

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Did I miss something?

    No - a bug in DataTables 1.10.8 :-(.

    This commit yesterday fixed it, and it is available in the dist repo. The nightly doesn't include this fix yet - I'm working on updating the way the nightlies work,s o they will be a bit out of date until I'm done with that work.

    Sorry for the trouble!

    Allan

  • idleogidleog Posts: 6Questions: 1Answers: 0
    edited August 2015

    thanks, Allan

    That fixes the error.

    But: after call cell.invalidete(), on next action (like search, rowreorder, I think when draw() is called), I get following alert:

    DataTables warning: table id=goe-indextable - Requested unknown parameter '0' for row 1. For more information about this error, please see http://datatables.net/tn/4

    http://debug.datatables.net/avajev

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Could you possibly give me a link to the page so I can debug it please? Unfortunately the debugger doesn't give enough information for this case.

    Allan

  • idleogidleog Posts: 6Questions: 1Answers: 0

    Here is a link: http://schmuck.goeldi-web.ch/schmuckadmin/categories

    Use an eye-button to trigger an invalidate event. Then reorder rows (dragging first column) or use the search field.

    Cheers, Peter

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    Hi Peter,

    Fantastic - thank you for the test case. I've just committed the fix and the dist repo has been synced with the source. If you use the DataTables file from the dist repo the issue should be resolved.

    Regards,
    Allan

  • idleogidleog Posts: 6Questions: 1Answers: 0

    Perfect!

    Thanks, I very appreciate your work!

    Cheers,
    Peter

This discussion has been closed.