Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete modal doesn't show any data #195

Open
iltekin opened this issue Oct 6, 2021 · 12 comments
Open

Delete modal doesn't show any data #195

iltekin opened this issue Oct 6, 2021 · 12 comments

Comments

@iltekin
Copy link

iltekin commented Oct 6, 2021

I just reported an issue about modal titles about non-minified JS file.
When you use minified js file, there is no modal title problem (these files are not same!)

But in Delete Modal, there is no data in modal body and not working when you click delete button.
In modal body there is only this text:

Are you sure you wish to delete 1 rows?

@luca-vercelli
Copy link
Collaborator

Yes, this is a recent PR from @gogoafuzzz. Deletion of many rows is supported, so the modal dialog does not display their content. What you mean with "not working"? what happens when you click Delete button?

btw, I will delete the minified file, it's outdated.

@iltekin
Copy link
Author

iltekin commented Oct 7, 2021

Nothing happens when i clicked the button there was an error on console:

Uncaught TypeError: Cannot read properties of undefined (reading 'rows') at dataTables.altEditor.free.js:537

@camandel
Copy link
Contributor

camandel commented Dec 6, 2021

I had to switch back to commit ffd3005 to avoid this error (rowdata was empty).

@paulmcgann
Copy link

@camandel

I am getting the same issue when using ajax, is this the same scenario you are experiencing this with or are there other scenarios this is happening too also?

@camandel
Copy link
Contributor

camandel commented Dec 9, 2021

@paulmcgann yes, same scenario with ajax

Probably related to #190

@SinisterSpatula
Copy link

Yep, ran into the same issue, as @paulmcgann mentioned, if I switch to commit ffd3005 version of dataTables.altEditor.free.js the delete modal now shows data in the box and actually has rowdata object with data in it instead of being undefined. I was getting an ajax error that it couldn't process the data object, and that's because rowdata was empty. So the new multiple row select does not seem to work if you are only selecting one row. (And I can't seem to select multiple rows either, just one row at a time. Clicking a second row just de-selects the previous).

@gofunz
Copy link
Contributor

gofunz commented Dec 17, 2021

Hi, You need set select: multiple.

onDeleteRow() can refer to Support delete multiple rows

selectedRows : https://datatables.net/reference/api/rows().data()

Example:

const table = $(`#table`).DataTable({
        select: "multiple",
        altEditor: true,
        onDeleteRow: function(alteditor, selectedRows, success, error) {
            console.log(selectedRows.data())
        }
})

Sorry, My English is not well.

@SinisterSpatula
Copy link

Ah, thank you! Of course that makes perfect sense now. 💯 If I may suggest, maybe the code can be changed to still fill rowdata with the one selected row so that onDeleteRow will still work and not error out due to empty rowdata in this case. I should have revisited the documentation, my mistake. :) It's been a while since I worked with AltEditor. It's great!

@paulmcgann
Copy link

@gogoafuzzz is the same configuration required when using a custom delete button on the row?

I have a column defined as below:

{
data: null,
title: "Delete",
name: "Delete",
render: function (data, type, row, meta) {
return '';
},
disabled: true
}

However when I have the setting updated I am getting the following:

dataTables.altEditor.free.js:537

   Uncaught TypeError: Cannot read properties of undefined (reading 'rows')
at dataTables.altEditor.free.js:537
at e (jquery.min.js:4)
at xb (jquery.min.js:4)
at xb (jquery.min.js:4)
at Object.<anonymous> (jquery.min.js:4)
at Function.each (jquery.min.js:2)
at xb (jquery.min.js:4)
at xb (jquery.min.js:4)
at xb (jquery.min.js:4)
at xb (jquery.min.js:4)

This happens after clicking the modal delete button.

@gofunz
Copy link
Contributor

gofunz commented Dec 22, 2021

@gogoafuzzz is the same configuration required when using a custom delete button on the row?

I have a column defined as below:

{ data: null, title: "Delete", name: "Delete", render: function (data, type, row, meta) { return ''; }, disabled: true }

However when I have the setting updated I am getting the following:

dataTables.altEditor.free.js:537

   Uncaught TypeError: Cannot read properties of undefined (reading 'rows')
at dataTables.altEditor.free.js:537
at e (jquery.min.js:4)
at xb (jquery.min.js:4)
at xb (jquery.min.js:4)
at Object.<anonymous> (jquery.min.js:4)
at Function.each (jquery.min.js:2)
at xb (jquery.min.js:4)
at xb (jquery.min.js:4)
at xb (jquery.min.js:4)
at xb (jquery.min.js:4)

This happens after clicking the modal delete button.

Hi, the name must be "delete", can refer to example1 - L88

@gofunz
Copy link
Contributor

gofunz commented Dec 22, 2021

Ah, thank you! Of course that makes perfect sense now. 💯 If I may suggest, maybe the code can be changed to still fill rowdata with the one selected row so that onDeleteRow will still work and not error out due to empty rowdata in this case. I should have revisited the documentation, my mistake. :) It's been a while since I worked with AltEditor. It's great!

@SinisterSpatula Thanks for your suggestion, I create a pull request to fix it.

@ncdv23
Copy link

ncdv23 commented May 15, 2023

Hi, You need set select: multiple.

onDeleteRow() can refer to Support delete multiple rows

selectedRows : https://datatables.net/reference/api/rows().data()

Example:

const table = $(`#table`).DataTable({
        select: "multiple",
        altEditor: true,
        onDeleteRow: function(alteditor, selectedRows, success, error) {
            console.log(selectedRows.data())
        }
})

Sorry, My English is not well.

My console keeps saying selectedRows.data is not a function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants