Issue with Editor Selection

Issue with Editor Selection

YOMYOM Posts: 51Questions: 21Answers: 1

I have a fully functional table with editing, but I am having one minor issue that continues to elude me. Upon running a javascript function which contains the following code, all previously selected rows are deselected. I know that when a normal reload function is called on a table, it keeps the rows selected. However, when I programmatically submit an edit, everything is deselected.

var selected = table.rows( { selected: true }).toArray()[0]
  editor.edit( table.rows( { selected: true } ).indexes(), false ).set( 'gnotes', pricedate ).submit();
  selected.forEach(function(s) {
    table.row(s).select();
  });

If I change the row inside the loop to:

table.row(s+5).select();

It correctly selects the row(s) 5 ahead of the currently selected row(s) BEFORE the currently selected rows are deselected. This leads me to believe that the editor.edit().set().submit() is being run asynchronously. Although this is just speculation. After a brief review of the editor.submit() docs, I was unable to find out whether or not this request is run asynchronously or how I could go about fixing this problem.

Any guidance would be greatly appreciated.

Thanks,
Philip

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    Hi Philip,

    Are you using server-side processing by any chance? If so this example might be of use - particularly if you are using a custom id property for the row.

    Allan

  • YOMYOM Posts: 51Questions: 21Answers: 1
    edited March 2018

    Hi Allan,

    Yes, I am using server-side processing. It is also worth mentioning that if I use

    table.ajax.reload()
    

    instead of the editor.submit as mentioned in your linked example, then the issue is no longer present.

    Philip

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    That's interesting. Are you able to give me a link to the page showing the issue so I can take a look at it please?

    Allan

  • YOMYOM Posts: 51Questions: 21Answers: 1

    I'd rather not post it publicly so I will send you a PM with the info.

This discussion has been closed.